Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some optimizations #199

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ public function getChartUrl($directUrl = true)
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = round((strlen($this->_simpleEncoding)-1) * ($yorigin + $currentvalue) / $yrange);
array_push($chartdata, substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter);
$chartdata[] = substr($this->_simpleEncoding, $ylocation, 1) . $dataDelimiter;
} else {
array_push($chartdata, $dataMissing . $dataDelimiter);
$chartdata[] = $dataMissing . $dataDelimiter;
}
}
// END SIMPLE ENCODING
Expand All @@ -331,14 +331,14 @@ public function getChartUrl($directUrl = true)
$secondchar = $ylocation % 64;
$mappedchar = substr($this->_extendedEncoding, $firstchar, 1)
. substr($this->_extendedEncoding, $secondchar, 1);
array_push($chartdata, $mappedchar . $dataDelimiter);
$chartdata[] = $mappedchar . $dataDelimiter;
} else {
array_push($chartdata, $dataMissing . $dataDelimiter);
$chartdata[] = $dataMissing . $dataDelimiter;
}
}
// ============= END EXTENDED ENCODING =============
}
array_push($chartdata, $dataSetdelimiter);
$chartdata[] = $dataSetdelimiter;
}
$buffer = implode('', $chartdata);

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Bundle/Model/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function addSelection($selection)
if (!$selections = $this->getData('selections')) {
$selections = array();
}
array_push($selections, $selection);
$selections[] = $selection;
$this->setSelections($selections);
return $this;
}
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Connect/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public function getCustomExtensionPackageFormData()
) {
continue;
}
array_push($data['authors']['name'], $data['maintainers']['name'][$i]);
array_push($data['authors']['user'], $data['maintainers']['handle'][$i]);
array_push($data['authors']['email'], $data['maintainers']['email'][$i]);
$data['authors']['name'][] = $data['maintainers']['name'][$i];
$data['authors']['user'][] = $data['maintainers']['handle'][$i];
$data['authors']['email'][] = $data['maintainers']['email'][$i];
}
// Convert channel from previous version for entire package
$helper = Mage::helper('Mage_Connect_Helper_Data');
Expand Down
8 changes: 4 additions & 4 deletions app/code/core/Mage/Core/Model/Email/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class Mage_Core_Model_Email_Info extends Varien_Object
*/
public function addBcc($email, $name = null)
{
array_push($this->_bccNames, $name);
array_push($this->_bccEmails, $email);
$this->_bccNames[] = $name;
$this->_bccEmails[] = $email;
return $this;
}

Expand All @@ -90,8 +90,8 @@ public function addBcc($email, $name = null)
*/
public function addTo($email, $name = null)
{
array_push($this->_toNames, $name);
array_push($this->_toEmails, $email);
$this->_toNames[] = $name;
$this->_toEmails[] = $email;
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Email/Template/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Mage_Core_Model_Email_Template_Mailer extends Varien_Object
*/
public function addEmailInfo(Mage_Core_Model_Email_Info $emailInfo)
{
array_push($this->_emailInfos, $emailInfo);
$this->_emailInfos[] = $emailInfo;
return $this;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Store/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function getStoresByLocale($locale)
foreach ($this->getStores() as $store) {
/* @var $store Mage_Core_Model_Store */
if ($store->getLocaleCode() == $locale) {
array_push($stores, $store);
$stores[] = $store;
}
}
return $stores;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Theme/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function _registerThemeRecursively(&$theme, $inheritanceChain = array(
Mage::throwException(Mage::helper('Mage_Core_Helper_Data')
->__('Circular-reference in theme inheritance detected for "%s"', $tempId));
}
array_push($inheritanceChain, $tempId);
$inheritanceChain[] = $tempId;
$parentTheme = $theme->getParentTheme();
if ($parentTheme) {
$this->_registerThemeRecursively($parentTheme, $inheritanceChain);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public function resetPasswordPostAction()

$errorMessages = array();
if (iconv_strlen($password) <= 0) {
array_push($errorMessages, Mage::helper('Mage_Customer_Helper_Data')->__('New password field cannot be empty.'));
$errorMessages[] = Mage::helper('Mage_Customer_Helper_Data')->__('New password field cannot be empty.');
}
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('Mage_Customer_Model_Customer')->load($customerId);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Sales/Model/Quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ public function getErrors()
foreach ($this->getMessages() as $message) {
/* @var $error Mage_Core_Model_Message_Abstract */
if ($message->getType() == Mage_Core_Model_Message::ERROR) {
array_push($errors, $message);
$errors[] = $message;
}
}
return $errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function render()
(string)$piece->LicensePlate,
(string)$piece->LicensePlateBarCode
);
array_push($pdf->pages, $page);
$pdf->pages[] = $page;
$i++;
}
return $pdf->render();
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/User/Block/Role/Tab/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function _construct()
foreach ($rulesSet->getItems() as $item) {
$itemResourceId = $item->getResource_id();
if ($acl->has($itemResourceId) && $item->getPermission() == 'allow') {
array_push($selectedResourceIds, $itemResourceId);
$selectedResourceIds[] = $itemResourceId;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ public function resetPasswordPostAction()

$errorMessages = array();
if (iconv_strlen($password) <= 0) {
array_push(
$errorMessages,
Mage::helper('Mage_User_Helper_Data')->__('New password field cannot be empty.')
);
$errorMessages[] = Mage::helper('Mage_User_Helper_Data')->__('New password field cannot be empty.');
}
/** @var $user Mage_User_Model_User */
$user = Mage::getModel('Mage_User_Model_User')->load($userId);
Expand Down
4 changes: 2 additions & 2 deletions dev/tests/js/run_js_tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
}
}
if (!$found) {
array_push($sortedFiles, $loadFile);
$sortedFiles[] = $loadFile;
}
}
}
Expand Down Expand Up @@ -226,7 +226,7 @@ function listFiles($dirs)
$path = $baseDir . $dir;
if (is_file($path)) {
$path = substr_replace($path, RELATIVE_APP_ROOT, 0, strlen($baseDir));
array_push($result, $path);
$result[] = $path;
} else {
$paths = glob($path . '/*', GLOB_ONLYDIR | GLOB_NOSORT);
$paths = substr_replace($paths, '', 0, strlen($baseDir));
Expand Down
4 changes: 2 additions & 2 deletions downloader/lib/Mage/Connect/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function doError($command, $message)
*/
public function pushCapture()
{
array_push($this->_captureSaved, $this->_capture);
$this->_captureSaved[] = $this->_capture;
return $this;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ public function getOutput($clearPrevious = true)
*/
public function pushSilent()
{
array_push($this->_silentSaved, $this->_silent);
$this->_silentSaved[] = $this->_silent;
return $this;
}

Expand Down
6 changes: 3 additions & 3 deletions downloader/lib/Mage/Connect/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ public function importDataV1x(array $data)
$author['name'] = $authorRawData['name'];
$author['user'] = $authorRawData['user'];
$author['email'] = $authorRawData['email'];
array_push($authors, $author);
$authors[] = $author;
}
}
}
Expand Down Expand Up @@ -1420,7 +1420,7 @@ public function importDataV1x(array $data)
$extension['name'] = $extensionRawData['name'];
$extension['min_version'] = isset($extensionRawData['min']) ? $extensionRawData['min'] : null;
$extension['max_version'] = isset($extensionRawData['max']) ? $extensionRawData['max'] : null;
array_push($extensions, $extension);
$extensions[] = $extension;
}
}
// Handle packages
Expand All @@ -1435,7 +1435,7 @@ public function importDataV1x(array $data)
$package['channel'] = $this->convertChannelFromV1x($packageRawData['channel']);
$package['min_version'] = isset($packageRawData['min']) ? $packageRawData['min'] : null;
$package['max_version'] = isset($packageRawData['max']) ? $packageRawData['max'] : null;
array_push($packages, $package);
$packages[] = $package;
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/Mage/Connect/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

class Mage_Connect_Frontend
{

Expand Down Expand Up @@ -120,7 +119,7 @@ public function doError($command, $message)
*/
public function pushCapture()
{
array_push($this->_captureSaved, $this->_capture);
$this->_captureSaved[] = $this->_capture;
return $this;
}

Expand Down Expand Up @@ -204,7 +203,7 @@ public function getOutput($clearPrevious = true)
*/
public function pushSilent()
{
array_push($this->_silentSaved, $this->_silent);
$this->_silentSaved[] = $this->_silent;
return $this;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Magento/Di/Zend.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function newInstance($name, array $parameters = array(), $isShared = true
$definitions = $this->definitions;

if (!$this->definitions()->hasClass($name)) {
array_push($this->instanceContext, array('NEW', $name, $name));
$this->instanceContext[] = array('NEW', $name, $name);

if ($this->_isArrayHasDataKey($parameters)) {
$parameters = reset($parameters);
Expand Down Expand Up @@ -141,7 +141,7 @@ public function newInstance($name, array $parameters = array(), $isShared = true
$alias = null;
}

array_push($this->instanceContext, array('NEW', $class, $alias));
$this->instanceContext[] = array('NEW', $class, $alias);

if (!$definitions->hasClass($class)) {
$aliasMsg = ($alias) ? '(specified by alias ' . $alias . ') ' : '';
Expand Down Expand Up @@ -542,7 +542,7 @@ protected function resolveMethodParameters($class, $method, array $callTimeUserP
"Circular dependency detected: $class depends on {$value[1]} and vice versa"
);
}
array_push($this->currentDependencies, $class);
$this->currentDependencies[] = $class;
$dConfig = $this->instanceManager->getConfig($computedParams['required'][$fqParamPos][0]);
if ($dConfig['shared'] === false) {
$resolvedParams[$index]
Expand Down
4 changes: 2 additions & 2 deletions lib/PEAR/PEAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ function setErrorHandling($mode = null, $options = null)
function expectError($code = '*')
{
if (is_array($code)) {
array_push($this->_expected_errors, $code);
$this->_expected_errors[] = $code;
} else {
array_push($this->_expected_errors, array($code));
$this->_expected_errors[] = array($code);
}
return sizeof($this->_expected_errors);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/PEAR/PEAR/PEAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ function setErrorHandling($mode = null, $options = null)
function expectError($code = '*')
{
if (is_array($code)) {
array_push($this->_expected_errors, $code);
$this->_expected_errors[] = $code;
} else {
array_push($this->_expected_errors, array($code));
$this->_expected_errors[] = array($code);
}
return sizeof($this->_expected_errors);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/PEAR/XML/Parser/Simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ function reset()
*/
function startHandler($xp, $elem, &$attribs)
{
array_push($this->_elStack, array(
$this->_elStack[] = array(
'name' => $elem,
'attribs' => $attribs
));
);
$this->_depth++;
$this->_data[$this->_depth] = '';
}
Expand Down
12 changes: 6 additions & 6 deletions lib/PEAR/XML/Unserializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ function startHandler($parser, $element, $attribs)
$attribs[$this->options[XML_UNSERIALIZER_OPTION_ATTRIBUTE_CLASS]];
}

array_push($this->_valStack, $val);
$this->_valStack[] = $val;
}

/**
Expand Down Expand Up @@ -903,17 +903,17 @@ function endHandler($parser, $element)
} else {
$parent['children'][$value['name']] = array();
}
array_push($parent['aggregKeys'], $value['name']);
$parent['aggregKeys'][] = $value['name'];
}
array_push($parent['children'][$value['name']], $value['value']);
$parent['children'][$value['name']][] = $value['value'];
} else {
$parent['children'][$value['name']] = &$value['value'];
array_push($parent['childrenKeys'], $value['name']);
$parent['childrenKeys'][] = $value['name'];
}
} else {
array_push($parent['children'], $value['value']);
$parent['children'][] = $value['value'];
}
array_push($this->_valStack, $parent);
$this->_valStack[] = $parent;
}

$this->_depth--;
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Tree/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function removeChild($childNode)
public function getPath(&$prevNodes = array())
{
if ($this->_parent) {
array_push($prevNodes, $this);
$prevNodes[] = $this;
$this->_parent->getPath($prevNodes);
}
return $prevNodes;
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Io/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function getCleanPath($path)
}
}

array_push($realPathParts, $pathParts[$i]);
$realPathParts[] = $pathParts[$i];
}

return $pathTokR . implode('/', $realPathParts);
Expand Down
4 changes: 2 additions & 2 deletions lib/Zend/Cloud/StorageService/Adapter/Nirvanix.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ private function getAllFolders($path, &$resultArray)
//more than one, but doesn't return an array if there is only one.
if ($numFolders == 1) {
$folderPath = $response->ListFolder->Folder->Path;
array_push($resultArray, $folderPath);
$resultArray[] = $folderPath;
$this->getAllFolders('/' . $folderPath, $resultArray);
} else {
foreach ($response->ListFolder->Folder as $arrayElem) {
$folderPath = $arrayElem->Path;
array_push($resultArray, $folderPath);
$resultArray[] = $folderPath;
$this->getAllFolders('/' . $folderPath, $resultArray);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Code/Reflection/MethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getBody()
$lastLine = array_pop($lines);

if (trim($lastLine) !== '}') {
array_push($lines, $lastLine);
$lines[] = $lastLine;
}

// just in case we had code on the bracket lines
Expand Down
6 changes: 4 additions & 2 deletions lib/Zend/Code/Scanner/DocBlockScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ protected function scan()
goto SCANNER_CONTINUE;
}
case 'DOCBLOCK_TAG':
array_push($this->tags, array('name' => $token[1],
'value' => ''));
$this->tags[] = array(
'name' => $token[1],
'value' => ''
);
end($this->tags);
$tagIndex = key($this->tags);
$mode = 3;
Expand Down
2 changes: 1 addition & 1 deletion lib/Zend/Controller/Plugin/ActionStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function _saveStack(array $stack)
public function pushStack(Zend_Controller_Request_Abstract $next)
{
$stack = $this->getStack();
array_push($stack, $next);
$stack[] = $next;
return $this->_saveStack($stack);
}

Expand Down
Loading