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

Replace lib/Zend with shardj/zf1-future 🚀 #2827

Merged
merged 13 commits into from
Dec 22, 2022
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1,090 changes: 0 additions & 1,090 deletions app/code/core/Zend/Controller/Request/Http.php

This file was deleted.

4,952 changes: 0 additions & 4,952 deletions app/code/core/Zend/Date.php

This file was deleted.

97 changes: 49 additions & 48 deletions app/code/core/Zend/Db/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @version $Id$
*/


/**
* @see Zend_Db_Adapter_Abstract
*/
Expand All @@ -41,6 +42,7 @@
*/
class Zend_Db_Select
{

const DISTINCT = 'distinct';
const COLUMNS = 'columns';
const FROM = 'from';
Expand Down Expand Up @@ -83,7 +85,7 @@ class Zend_Db_Select
*
* @var array
*/
protected $_bind = array();
protected $_bind = [];

/**
* Zend_Db_Adapter_Abstract object.
Expand All @@ -99,71 +101,71 @@ class Zend_Db_Select
*
* @var array
*/
protected static $_partsInit = array(
protected static $_partsInit = [
self::DISTINCT => false,
self::COLUMNS => array(),
self::UNION => array(),
self::FROM => array(),
self::WHERE => array(),
self::GROUP => array(),
self::HAVING => array(),
self::ORDER => array(),
self::COLUMNS => [],
self::UNION => [],
self::FROM => [],
self::WHERE => [],
self::GROUP => [],
self::HAVING => [],
self::ORDER => [],
self::LIMIT_COUNT => null,
self::LIMIT_OFFSET => null,
self::FOR_UPDATE => false
);
];

/**
* Specify legal join types.
*
* @var array
*/
protected static $_joinTypes = array(
protected static $_joinTypes = [
self::INNER_JOIN,
self::LEFT_JOIN,
self::RIGHT_JOIN,
self::FULL_JOIN,
self::CROSS_JOIN,
self::NATURAL_JOIN,
);
];

/**
* Specify legal union types.
*
* @var array
*/
protected static $_unionTypes = array(
protected static $_unionTypes = [
self::SQL_UNION,
self::SQL_UNION_ALL
);
];

/**
* The component parts of a SELECT statement.
* Initialized to the $_partsInit array in the constructor.
*
* @var array
*/
protected $_parts = array();
protected $_parts = [];

/**
* Tracks which columns are being select from each table and join.
*
* @var array
*/
protected $_tableCols = array();
protected $_tableCols = [];

/**
* List of MySql specific control characters
*
* @var array
*/
protected $_controlCharacters = array(
protected $_controlCharacters = [
';',
'--',
'#',
'/*',
'*/',
);
];

/**
* Class constructor
Expand Down Expand Up @@ -287,7 +289,7 @@ public function columns($cols = '*', $correlationName = null)
* @param array $select Array of select clauses for the union.
* @return $this This Zend_Db_Select object.
*/
public function union($select = array(), $type = self::SQL_UNION)
public function union($select = [], $type = self::SQL_UNION)
{
if (!is_array($select)) {
#require_once 'Zend/Db/Select/Exception.php';
Expand All @@ -302,7 +304,7 @@ public function union($select = array(), $type = self::SQL_UNION)
}

foreach ($select as $target) {
$this->_parts[self::UNION][] = array($target, $type);
$this->_parts[self::UNION][] = [$target, $type];
}

return $this;
Expand Down Expand Up @@ -515,7 +517,7 @@ public function orWhere($cond, $value = null, $type = null)
public function group($spec)
{
if (!is_array($spec)) {
$spec = array($spec);
$spec = [$spec];
}

foreach ($spec as $val) {
Expand Down Expand Up @@ -609,7 +611,7 @@ public function orHaving($cond, $value = null, $type = null)
public function order($spec)
{
if (!is_array($spec)) {
$spec = array($spec);
$spec = [$spec];
}

// force 'ASC' or 'DESC' on each order spec, default is ASC.
Expand All @@ -634,7 +636,7 @@ public function order($spec)
) {
$val = new Zend_Db_Expr($val);
}
$this->_parts[self::ORDER][] = array($val, $direction);
$this->_parts[self::ORDER][] = [$val, $direction];
}
}

Expand Down Expand Up @@ -707,7 +709,7 @@ public function getPart($part)
* @param mixed $bind An array of data to bind to the placeholders.
* @return Zend_Db_Statement
*/
public function query($fetchMode = null, $bind = array())
public function query($fetchMode = null, $bind = [])
{
if (!empty($bind)) {
$this->bind($bind);
Expand Down Expand Up @@ -835,15 +837,13 @@ protected function _join($type, $name, $cond, $cols, $schema = null)
* @see Zend_Db_Select_Exception
*/
#require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception(
"You cannot define a correlation name '$correlationName' more than once"
);
throw new Zend_Db_Select_Exception("You cannot define a correlation name '$correlationName' more than once");
}

if ($type == self::FROM) {
// append this from after the last from joinType
$tmpFromParts = $this->_parts[self::FROM];
$this->_parts[self::FROM] = array();
$this->_parts[self::FROM] = [];
// move all the froms onto the stack
while ($tmpFromParts) {
$currentCorrelationName = key($tmpFromParts);
Expand All @@ -854,14 +854,14 @@ protected function _join($type, $name, $cond, $cols, $schema = null)
$this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
}
} else {
$tmpFromParts = array();
$tmpFromParts = [];
}
$this->_parts[self::FROM][$correlationName] = array(
$this->_parts[self::FROM][$correlationName] = [
'joinType' => $type,
'schema' => $schema,
'tableName' => $tableName,
'joinCondition' => $cond
);
];
while ($tmpFromParts) {
$currentCorrelationName = key($tmpFromParts);
$this->_parts[self::FROM][$currentCorrelationName] = array_shift($tmpFromParts);
Expand Down Expand Up @@ -912,7 +912,7 @@ public function _joinUsing($type, $name, $cond, $cols = '*', $schema = null)
$join = $this->_adapter->quoteIdentifier(key($this->_parts[self::FROM]), true);
$from = $this->_adapter->quoteIdentifier($this->_uniqueCorrelation($name), true);

$joinCond = array();
$joinCond = [];
foreach ((array)$cond as $fieldName) {
$cond1 = $from . '.' . $fieldName;
$cond2 = $join . '.' . $fieldName;
Expand Down Expand Up @@ -957,14 +957,14 @@ private function _uniqueCorrelation($name)
protected function _tableCols($correlationName, $cols, $afterCorrelationName = null)
{
if (!is_array($cols)) {
$cols = array($cols);
$cols = [$cols];
}

if ($correlationName == null) {
$correlationName = '';
}

$columnValues = array();
$columnValues = [];

foreach (array_filter($cols) as $alias => $col) {
$currentCorrelationName = $correlationName;
Expand All @@ -984,17 +984,17 @@ protected function _tableCols($correlationName, $cols, $afterCorrelationName = n
$col = $m[2];
}
}
$columnValues[] = array($currentCorrelationName, $col, is_string($alias) ? $alias : null);
$columnValues[] = [$currentCorrelationName, $col, is_string($alias) ? $alias : null];
}

if ($columnValues) {

// should we attempt to prepend or insert these values?
if ($afterCorrelationName === true || is_string($afterCorrelationName)) {
$tmpColumns = $this->_parts[self::COLUMNS];
$this->_parts[self::COLUMNS] = array();
$this->_parts[self::COLUMNS] = [];
} else {
$tmpColumns = array();
$tmpColumns = [];
}

// find the correlation name to insert after
Expand Down Expand Up @@ -1056,7 +1056,7 @@ protected function _where($condition, $value = null, $type = null, $bool = true)
*/
protected function _getDummyTable()
{
return array();
return [];
}

/**
Expand Down Expand Up @@ -1112,7 +1112,7 @@ protected function _renderColumns($sql)
return null;
}

$columns = array();
$columns = [];
foreach ($this->_parts[self::COLUMNS] as $columnEntry) {
list($correlationName, $column, $alias) = $columnEntry;
if ($column instanceof Zend_Db_Expr) {
Expand All @@ -1125,7 +1125,7 @@ protected function _renderColumns($sql)
if (empty($correlationName)) {
$columns[] = $this->_adapter->quoteColumnAs($column, $alias, true);
} else {
$columns[] = $this->_adapter->quoteColumnAs(array($correlationName, $column), $alias, true);
$columns[] = $this->_adapter->quoteColumnAs([$correlationName, $column], $alias, true);
}
}
}
Expand All @@ -1149,7 +1149,7 @@ protected function _renderFrom($sql)
$this->_parts[self::FROM] = $this->_getDummyTable();
}

$from = array();
$from = [];

foreach ($this->_parts[self::FROM] as $correlationName => $table) {
$tmp = '';
Expand Down Expand Up @@ -1230,7 +1230,7 @@ protected function _renderWhere($sql)
protected function _renderGroup($sql)
{
if ($this->_parts[self::FROM] && $this->_parts[self::GROUP]) {
$group = array();
$group = [];
foreach ($this->_parts[self::GROUP] as $term) {
$group[] = $this->_adapter->quoteIdentifier($term, true);
}
Expand Down Expand Up @@ -1264,15 +1264,15 @@ protected function _renderHaving($sql)
protected function _renderOrder($sql)
{
if ($this->_parts[self::ORDER]) {
$order = array();
$order = [];
foreach ($this->_parts[self::ORDER] as $term) {
if (is_array($term)) {
if(is_numeric($term[0]) && strval(intval($term[0])) == $term[0]) {
if(is_numeric($term[0]) && (string) ((int) ($term[0])) == $term[0]) {
$order[] = (int)trim($term[0]) . ' ' . $term[1];
} else {
$order[] = $this->_adapter->quoteIdentifier($term[0], true) . ' ' . $term[1];
}
} elseif (is_numeric($term) && strval(intval($term)) == $term) {
} elseif (is_numeric($term) && (string) ((int) $term) == $term) {
$order[] = (int)trim($term);
} else {
$order[] = $this->_adapter->quoteIdentifier($term, true);
Expand Down Expand Up @@ -1340,7 +1340,7 @@ protected function _renderForupdate($sql)
*/
public function __call($method, array $args)
{
$matches = array();
$matches = [];

/**
* Recognize methods for Has-Many cases:
Expand All @@ -1356,15 +1356,15 @@ public function __call($method, array $args)
#require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Unrecognized method '$method()'");
}
if (in_array($type, array(self::CROSS_JOIN, self::NATURAL_JOIN))) {
if (in_array($type, [self::CROSS_JOIN, self::NATURAL_JOIN])) {
#require_once 'Zend/Db/Select/Exception.php';
throw new Zend_Db_Select_Exception("Cannot perform a joinUsing with method '$method()'");
}
} else {
$type = self::INNER_JOIN;
}
array_unshift($args, $type);
return call_user_func_array(array($this, '_joinUsing'), $args);
return call_user_func_array([$this, '_joinUsing'], $args);
}

#require_once 'Zend/Db/Select/Exception.php';
Expand All @@ -1386,4 +1386,5 @@ public function __toString()
}
return (string)$sql;
}

}
Loading