From d634db87d432c87a092f1c4cee69a56914cbaa97 Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Thu, 19 Mar 2009 22:07:39 +0000 Subject: replace array_push() function calls with native language constuct if make sense --- framework/Collections/TQueue.php | 2 +- framework/Collections/TStack.php | 2 +- .../ActiveRecord/Relations/TActiveRecordRelation.php | 2 +- framework/Data/SqlMap/Statements/TMappedStatement.php | 2 +- framework/Web/Javascripts/TJSON.php | 16 ++++++++-------- framework/Web/UI/THtmlWriter.php | 4 ++-- framework/Web/UI/TTemplateManager.php | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'framework') diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php index d8b692d1..1eacfb0a 100644 --- a/framework/Collections/TQueue.php +++ b/framework/Collections/TQueue.php @@ -141,7 +141,7 @@ class TQueue extends TComponent implements IteratorAggregate,Countable public function enqueue($item) { ++$this->_c; - array_push($this->_d,$item); + $this->_d[] = $item; } /** diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php index 0d3890b4..3c8d5fc6 100644 --- a/framework/Collections/TStack.php +++ b/framework/Collections/TStack.php @@ -140,7 +140,7 @@ class TStack extends TComponent implements IteratorAggregate,Countable public function push($item) { ++$this->_c; - array_push($this->_d,$item); + $this->_d[] = $item; } /** diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index a352cb07..85dd6735 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -84,7 +84,7 @@ abstract class TActiveRecordRelation $obj->collectForeignObjects($results); } else if($results instanceof TActiveRecordRelation) - array_push($stack,$this); //call it later + $stack[] = $this; //call it later return $results; } diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index 6b11b107..c4bb53dd 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -869,7 +869,7 @@ class TMappedStatement extends TComponent implements IMappedStatement $postSelect->setMethod(self::QUERY_FOR_OBJECT); if(!$property->getLazyLoad()) - array_push($this->_selectQueque, $postSelect); + $this->_selectQueque[] = $postSelect; } /** diff --git a/framework/Web/Javascripts/TJSON.php b/framework/Web/Javascripts/TJSON.php index a52a0634..92a58815 100644 --- a/framework/Web/Javascripts/TJSON.php +++ b/framework/Web/Javascripts/TJSON.php @@ -508,9 +508,9 @@ class TJSON } } - array_push($stk, array('what' => self::JSON_SLICE, + $stk[] = array('what' => self::JSON_SLICE, 'where' => 0, - 'delim' => false)); + 'delim' => false); $chrs = substr($str, 1, -1); $chrs = $this->reduce_string($chrs); @@ -538,12 +538,12 @@ class TJSON // found a comma that is not inside a string, array, etc., // OR we've reached the end of the character list $slice = substr($chrs, $top['where'], ($c - $top['where'])); - array_push($stk, array('what' => self::JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); + $stk[] = array('what' => self::JSON_SLICE, 'where' => ($c + 1), 'delim' => false); //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); if (reset($stk) == self::JSON_IN_ARR) { // we are in an array, so just push an element onto the stack - array_push($arr, $this->decode($slice)); + $arr[] = $this->decode($slice); } elseif (reset($stk) == self::JSON_IN_OBJ) { // we are in an object, so figure @@ -576,7 +576,7 @@ class TJSON } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != self::JSON_IN_STR)) { // found a quote, and we are not inside a string - array_push($stk, array('what' => self::JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c})); + $stk = array('what' => self::JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}); //print("Found start of string at {$c}\n"); } elseif (($chrs{$c} == $top['delim']) && @@ -590,7 +590,7 @@ class TJSON } elseif (($chrs{$c} == '[') && in_array($top['what'], array(self::JSON_SLICE, self::JSON_IN_ARR, self::JSON_IN_OBJ))) { // found a left-bracket, and we are in an array, object, or slice - array_push($stk, array('what' => self::JSON_IN_ARR, 'where' => $c, 'delim' => false)); + $stk = array('what' => self::JSON_IN_ARR, 'where' => $c, 'delim' => false); //print("Found start of array at {$c}\n"); } elseif (($chrs{$c} == ']') && ($top['what'] == self::JSON_IN_ARR)) { @@ -601,7 +601,7 @@ class TJSON } elseif (($chrs{$c} == '{') && in_array($top['what'], array(self::JSON_SLICE, self::JSON_IN_ARR, self::JSON_IN_OBJ))) { // found a left-brace, and we are in an array, object, or slice - array_push($stk, array('what' => self::JSON_IN_OBJ, 'where' => $c, 'delim' => false)); + $stk = array('what' => self::JSON_IN_OBJ, 'where' => $c, 'delim' => false); //print("Found start of object at {$c}\n"); } elseif (($chrs{$c} == '}') && ($top['what'] == self::JSON_IN_OBJ)) { @@ -612,7 +612,7 @@ class TJSON } elseif (($substr_chrs_c_2 == '/*') && in_array($top['what'], array(self::JSON_SLICE, self::JSON_IN_ARR, self::JSON_IN_OBJ))) { // found a comment start, and we are in an array, object, or slice - array_push($stk, array('what' => self::JSON_IN_CMT, 'where' => $c, 'delim' => false)); + $stk = array('what' => self::JSON_IN_CMT, 'where' => $c, 'delim' => false); $c++; //print("Found start of comment at {$c}\n"); diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php index 217b9663..9713d941 100644 --- a/framework/Web/UI/THtmlWriter.php +++ b/framework/Web/UI/THtmlWriter.php @@ -232,12 +232,12 @@ class THtmlWriter extends TApplicationComponent implements ITextWriter if(isset(self::$_simpleTags[$tagName])) { $str.=' />'; - array_push($this->_openTags,''); + $this->_openTags[] = ''; } else { $str.='>'; - array_push($this->_openTags,$tagName); + $this->_openTags[] = $tagName; } $this->_writer->write($str); $this->_attributes=array(); diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index f44d414c..6d44d7d7 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -608,7 +608,7 @@ class TTemplate extends TApplicationComponent implements ITemplate $tpl[$c++]=array($container,$type,$attributes); if($str[strlen($str)-2]!=='/') // open tag { - array_push($stack,$type); + $stack[] = $type; $container=$c-1; } } @@ -695,7 +695,7 @@ class TTemplate extends TApplicationComponent implements ITemplate else // regular property { $prop=strtolower($match[3][0]); - array_push($stack,'@'.$prop); + $stack[] = '@'.$prop; if(!$expectPropEnd) { if($matchStart>$textStart) -- cgit v1.2.3