renaming narray back to NeatArray

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@314 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-07-04 01:39:06 +00:00
parent 0dd8b55d82
commit 1b30f48607
5 changed files with 28 additions and 28 deletions

View file

@ -297,7 +297,7 @@ class Model extends Object
function loadInfo ()
{
if (empty($this->_table_info))
$this->_table_info = new Narray($this->db->fields($this->table));
$this->_table_info = new NeatArray($this->db->fields($this->table));
return $this->_table_info;
}

View file

@ -7,9 +7,9 @@
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Narray {
class NeatArray {
/**
* Value of Narray.
* Value of NeatArray.
*
* @var array
* @access public
@ -21,20 +21,20 @@ class Narray {
*
* @param array $value
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function Narray ($value=array()) {
function NeatArray ($value=array()) {
$this->value = $value;
}
/**
* Finds and returns records with $fieldName equal $value from this Narray.
* Finds and returns records with $fieldName equal $value from this NeatArray.
*
* @param string $fieldName
* @param string $value
* @return mixed
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function findIn ($fieldName, $value)
{
@ -59,7 +59,7 @@ class Narray {
* Checks if $this->value is array, and removes all empty elements.
*
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function cleanup () {
$out = is_array($this->value)? array(): null;
@ -77,7 +77,7 @@ class Narray {
* @param string $value
* @return bool
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function add ($value) {
return ($this->value = $this->plus($value))? true: false;
@ -86,10 +86,10 @@ class Narray {
/**
* Returns itself merged with given array.
*
* @param array $value Array to add to Narray.
* @param array $value Array to add to NeatArray.
* @return array
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function plus ($value) {
return array_merge($this->value, (is_array($value)? $value: array($value)));
@ -101,7 +101,7 @@ class Narray {
* @param int $sortedBy A value of 1 sorts by values, a value of 2 sorts by keys. Defaults to null (no sorting).
* @return array
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function totals ($sortedBy=1,$reverse=true) {
$out = array();
@ -134,7 +134,7 @@ class Narray {
*
* @return array
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function walk ($with) {
array_walk($this->value, $with);
@ -156,7 +156,7 @@ class Narray {
*
* @return array
* @access public
* @uses Narray::value
* @uses NeatArray::value
*/
function extract ($name) {
$out = array();
@ -193,7 +193,7 @@ class Narray {
* $alice = array('id'=>'1', 'name'=>'Alice');
* $bob = array('id'=>'2', 'name'=>'Bob');
*
* $users = new Narray(array($alice, $bob));
* $users = new NeatArray(array($alice, $bob));
*
* $born = array
* (
@ -221,7 +221,7 @@ class Narray {
function joinWith ($his, $onMine, $onHis=null) {
if (empty($onHis)) $onHis = $onMine;
$his = new Narray($his);
$his = new NeatArray($his);
$out = array();
foreach ($this->value as $key=>$val) {
@ -264,7 +264,7 @@ class Narray {
}
// for backwards-compatibility, remove in 2008
class NeatArray extends Narray
class NeatArray extends NeatArray
{
}

View file

@ -30,7 +30,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('object', 'narray');
uses('object', 'neat_array');
/**
* Parses the request URL into controller, action, and parameters.
@ -156,7 +156,7 @@ class Router extends Object {
// unnamed elements go in as 'pass'
else
{
$pass = new Narray(explode('/', $found));
$pass = new NeatArray(explode('/', $found));
$pass->cleanup();
$out['pass'] = $pass->value;
}

View file

@ -69,7 +69,7 @@ require_once ROOT.'config/paths.php';
require_once ROOT.'libs/basics.php';
require_once ROOT.'libs/log.php';
require_once ROOT.'libs/object.php';
require_once ROOT.'libs/narray.php';
require_once ROOT.'libs/neat_array.php';
require_once ROOT.'libs/inflector.php';
DEBUG? error_reporting(E_ALL): error_reporting(0);

View file

@ -1,15 +1,15 @@
<?php
uses('narray');
uses('neat_array');
class NarrayTest extends UnitTestCase
class NeatArrayTest extends UnitTestCase
{
var $narray;
var $neatArray;
// constructor of the test suite
function NarrayTest()
function NeatArrayTest()
{
$this->UnitTestCase('Narray test');
$this->UnitTestCase('NeatArray test');
}
// called before the test functions will be executed
@ -17,7 +17,7 @@ class NarrayTest extends UnitTestCase
// here
function setUp()
{
$this->narray = new Narray();
$this->neatArray = new NeatArray();
}
// called after the test functions are executed
@ -25,7 +25,7 @@ class NarrayTest extends UnitTestCase
// here
function tearDown()
{
unset($this->narray);
unset($this->neatArray);
}
@ -36,7 +36,7 @@ class NarrayTest extends UnitTestCase
$c = array('foo'=>' bar', 'i-am'=>'c');
$d = array('foo'=>'bar', 'i-am'=>'d');
$n = new Narray(array($a, $b, $c, $d));
$n = new NeatArray(array($a, $b, $c, $d));
$result = $n->findIn('foo', ' bar ');
$expected = array(0=>$a);