@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @var array |
| 62 | 62 | */ |
| 63 | - private static $usedInstanceIds = []; |
|
| 63 | + private static $usedInstanceIds = [ ]; |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @var array |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | while ( in_array( $instance, self::$usedInstanceIds ) ) { |
| 133 | 133 | $instance = QueryHelper::random( 7 ); |
| 134 | 134 | } |
| 135 | - self::$usedInstanceIds[] = $instance; |
|
| 135 | + self::$usedInstanceIds[ ] = $instance; |
|
| 136 | 136 | |
| 137 | 137 | return $instance; |
| 138 | 138 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | return true; |
| 180 | 180 | |
| 181 | 181 | if ( $this->typeEL[ $name ] === self::ELEMENT_TYPE_ARRAY ) |
| 182 | - $this->syntaxEL[ $name ][] = $value; |
|
| 182 | + $this->syntaxEL[ $name ][ ] = $value; |
|
| 183 | 183 | else |
| 184 | 184 | $this->syntaxEL[ $name ] = $value; |
| 185 | 185 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * @param string $search |
| 242 | 242 | * @return string |
| 243 | 243 | */ |
| 244 | - public function bindParamsExpression( $expression, array $params = [], $search = '?' ) |
|
| 244 | + public function bindParamsExpression( $expression, array $params = [ ], $search = '?' ) |
|
| 245 | 245 | { |
| 246 | 246 | if ( !count( $params ) ) |
| 247 | 247 | return $expression; |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | $params = array_slice( $params, 0, substr_count( $expression, $search ) ); |
| 253 | 253 | |
| 254 | 254 | $i = 0; |
| 255 | - $arrayReturn = []; |
|
| 255 | + $arrayReturn = [ ]; |
|
| 256 | 256 | $expressionToArray = explode( $search, $expression ); |
| 257 | 257 | |
| 258 | 258 | foreach ( $expressionToArray as $sub ) { |
| 259 | - $arrayReturn[] = $sub; |
|
| 260 | - $arrayReturn[] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
| 259 | + $arrayReturn[ ] = $sub; |
|
| 260 | + $arrayReturn[ ] = array_key_exists( $i, $params ) ? $this->bindParam( 'exp', $params[ $i ] ) : ''; |
|
| 261 | 261 | $i++; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | * @param array $rowsForInsert |
| 26 | 26 | * @return $this |
| 27 | 27 | */ |
| 28 | - public function fromArray($fieldsList, array $rowsForInsert) |
|
| 28 | + public function fromArray( $fieldsList, array $rowsForInsert ) |
|
| 29 | 29 | { |
| 30 | - $this->setFieldsList($fieldsList); |
|
| 30 | + $this->setFieldsList( $fieldsList ); |
|
| 31 | 31 | |
| 32 | - foreach ($rowsForInsert as $row) |
|
| 33 | - $this->addSingleRow($row); |
|
| 32 | + foreach ( $rowsForInsert as $row ) |
|
| 33 | + $this->addSingleRow( $row ); |
|
| 34 | 34 | |
| 35 | 35 | return $this; |
| 36 | 36 | } |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | * @param QuerySelect $query |
| 42 | 42 | * @return $this |
| 43 | 43 | */ |
| 44 | - public function fromQuerySelect($fieldsList, QuerySelect $query) |
|
| 44 | + public function fromQuerySelect( $fieldsList, QuerySelect $query ) |
|
| 45 | 45 | { |
| 46 | - $this->setFieldsList($fieldsList); |
|
| 46 | + $this->setFieldsList( $fieldsList ); |
|
| 47 | 47 | |
| 48 | - foreach ($query->getBindParams() as $key => $value) |
|
| 49 | - $this->queryStructure->setParams($key, $value); |
|
| 48 | + foreach ( $query->getBindParams() as $key => $value ) |
|
| 49 | + $this->queryStructure->setParams( $key, $value ); |
|
| 50 | 50 | |
| 51 | - $this->queryStructure->replaceElement(QueryStructure::SET_FIELDS, $query); |
|
| 51 | + $this->queryStructure->replaceElement( QueryStructure::SET_FIELDS, $query ); |
|
| 52 | 52 | |
| 53 | 53 | return $this; |
| 54 | 54 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * @param string|array $fieldList |
| 59 | 59 | */ |
| 60 | - private function setFieldsList($fieldList) |
|
| 60 | + private function setFieldsList( $fieldList ) |
|
| 61 | 61 | { |
| 62 | - if (!is_array($fieldList)) |
|
| 63 | - $fieldList = QueryHelper::explode($fieldList); |
|
| 62 | + if ( !is_array( $fieldList ) ) |
|
| 63 | + $fieldList = QueryHelper::explode( $fieldList ); |
|
| 64 | 64 | |
| 65 | - $this->queryStructure->replaceElement(QueryStructure::FIELDS, $fieldList); |
|
| 65 | + $this->queryStructure->replaceElement( QueryStructure::FIELDS, $fieldList ); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,20 +71,20 @@ discard block |
||
| 71 | 71 | * @return $this |
| 72 | 72 | * @throws QueryException |
| 73 | 73 | */ |
| 74 | - private function addSingleRow(array $rowValues) |
|
| 74 | + private function addSingleRow( array $rowValues ) |
|
| 75 | 75 | { |
| 76 | 76 | |
| 77 | - if ($this->getNumberOfFields() !== count($rowValues)) |
|
| 78 | - throw new QueryException('Ivalid number of fields.', QueryException::QUERY_ERROR_INVALID_FIELDS_COUNT); |
|
| 77 | + if ( $this->getNumberOfFields() !== count( $rowValues ) ) |
|
| 78 | + throw new QueryException( 'Ivalid number of fields.', QueryException::QUERY_ERROR_INVALID_FIELDS_COUNT ); |
|
| 79 | 79 | |
| 80 | 80 | $pdoRowValues = array(); |
| 81 | 81 | |
| 82 | - foreach ($rowValues as $value) |
|
| 83 | - $pdoRowValues[] = $this->queryStructure->bindParam('value', $value); |
|
| 82 | + foreach ( $rowValues as $value ) |
|
| 83 | + $pdoRowValues[ ] = $this->queryStructure->bindParam( 'value', $value ); |
|
| 84 | 84 | |
| 85 | - $pdoRowValuesString = '( ' . QueryHelper::implode($pdoRowValues, ', ') . ' )'; |
|
| 85 | + $pdoRowValuesString = '( ' . QueryHelper::implode( $pdoRowValues, ', ' ) . ' )'; |
|
| 86 | 86 | |
| 87 | - $this->queryStructure->setElement(QueryStructure::SET_FIELDS, $pdoRowValuesString); |
|
| 87 | + $this->queryStructure->setElement( QueryStructure::SET_FIELDS, $pdoRowValuesString ); |
|
| 88 | 88 | |
| 89 | 89 | return $this; |
| 90 | 90 | } |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | private function getInsertMultipleRowsSyntax() |
| 96 | 96 | { |
| 97 | - if (is_a($this->queryStructure->getElement(QueryStructure::SET_FIELDS), QuerySelect::class)) |
|
| 97 | + if ( is_a( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ), QuerySelect::class ) ) |
|
| 98 | 98 | return $this->getSyntaxWithSelect(); |
| 99 | 99 | |
| 100 | - $fields = '( ' . QueryHelper::implode($this->queryStructure->getElement(QueryStructure::FIELDS), ', ') . ' )'; |
|
| 101 | - $values = QueryHelper::implode($this->queryStructure->getElement(QueryStructure::SET_FIELDS), ', '); |
|
| 100 | + $fields = '( ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::FIELDS ), ', ' ) . ' )'; |
|
| 101 | + $values = QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ), ', ' ); |
|
| 102 | 102 | |
| 103 | 103 | return $fields . ' VALUES ' . $values; |
| 104 | 104 | } |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function getSyntaxWithSelect() |
| 111 | 111 | { |
| 112 | - $fields = '( ' . QueryHelper::implode($this->queryStructure->getElement(QueryStructure::FIELDS), ', ') . ' )'; |
|
| 112 | + $fields = '( ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::FIELDS ), ', ' ) . ' )'; |
|
| 113 | 113 | |
| 114 | - return $fields . ' ' . $this->queryStructure->getElement(QueryStructure::SET_FIELDS)->getSyntax(); |
|
| 114 | + return $fields . ' ' . $this->queryStructure->getElement( QueryStructure::SET_FIELDS )->getSyntax(); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | private function getNumberOfFields() |
| 121 | 121 | { |
| 122 | - return count($this->queryStructure->getElement(QueryStructure::FIELDS)); |
|
| 122 | + return count( $this->queryStructure->getElement( QueryStructure::FIELDS ) ); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -22,29 +22,29 @@ discard block |
||
| 22 | 22 | * @return $this |
| 23 | 23 | * @throws QueryException |
| 24 | 24 | */ |
| 25 | - public function fields($fields) |
|
| 25 | + public function fields( $fields ) |
|
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - switch (gettype($fields)) { |
|
| 28 | + switch ( gettype( $fields ) ) { |
|
| 29 | 29 | case QueryStructure::ELEMENT_TYPE_ARRAY: |
| 30 | 30 | |
| 31 | - $fields = $this->prepareArrayFields($fields); |
|
| 31 | + $fields = $this->prepareArrayFields( $fields ); |
|
| 32 | 32 | |
| 33 | - if (count($fields)) |
|
| 34 | - $this->queryStructure->setElement(QueryStructure::FIELDS, implode(', ', $fields)); else |
|
| 35 | - $this->queryStructure->setElement(QueryStructure::FIELDS, '*'); |
|
| 33 | + if ( count( $fields ) ) |
|
| 34 | + $this->queryStructure->setElement( QueryStructure::FIELDS, implode( ', ', $fields ) ); else |
|
| 35 | + $this->queryStructure->setElement( QueryStructure::FIELDS, '*' ); |
|
| 36 | 36 | break; |
| 37 | 37 | |
| 38 | 38 | case QueryStructure::ELEMENT_TYPE_STRING: |
| 39 | 39 | |
| 40 | - $fields = trim($fields); |
|
| 41 | - if ('' !== $fields) |
|
| 42 | - $this->queryStructure->setElement(QueryStructure::FIELDS, $fields); else |
|
| 43 | - $this->queryStructure->setElement(QueryStructure::FIELDS, '*'); |
|
| 40 | + $fields = trim( $fields ); |
|
| 41 | + if ( '' !== $fields ) |
|
| 42 | + $this->queryStructure->setElement( QueryStructure::FIELDS, $fields ); else |
|
| 43 | + $this->queryStructure->setElement( QueryStructure::FIELDS, '*' ); |
|
| 44 | 44 | break; |
| 45 | 45 | |
| 46 | 46 | default: |
| 47 | - throw new QueryException('Invalid fields parameter type', QueryException::QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY); |
|
| 47 | + throw new QueryException( 'Invalid fields parameter type', QueryException::QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY ); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | |
@@ -56,16 +56,16 @@ discard block |
||
| 56 | 56 | * @return array |
| 57 | 57 | * @throws QueryException |
| 58 | 58 | */ |
| 59 | - private function prepareArrayFields($fieldsArray = array()) |
|
| 59 | + private function prepareArrayFields( $fieldsArray = array() ) |
|
| 60 | 60 | { |
| 61 | - $prepareArray = []; |
|
| 61 | + $prepareArray = [ ]; |
|
| 62 | 62 | |
| 63 | - foreach ($fieldsArray as $field) { |
|
| 64 | - if (gettype($field) !== QueryStructure::ELEMENT_TYPE_STRING) |
|
| 65 | - throw new QueryException('Invalid select field type!', QueryException::QUERY_ERROR_SELECT_INVALID_FIELD); |
|
| 63 | + foreach ( $fieldsArray as $field ) { |
|
| 64 | + if ( gettype( $field ) !== QueryStructure::ELEMENT_TYPE_STRING ) |
|
| 65 | + throw new QueryException( 'Invalid select field type!', QueryException::QUERY_ERROR_SELECT_INVALID_FIELD ); |
|
| 66 | 66 | |
| 67 | - if ('' !== trim($field)) |
|
| 68 | - $prepareArray[] = trim($field); |
|
| 67 | + if ( '' !== trim( $field ) ) |
|
| 68 | + $prepareArray[ ] = trim( $field ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $prepareArray; |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | * @return $this |
| 25 | 25 | * @throws QueryException |
| 26 | 26 | */ |
| 27 | - public function groupBy($column, array $allowedColumns = []) |
|
| 27 | + public function groupBy( $column, array $allowedColumns = [ ] ) |
|
| 28 | 28 | { |
| 29 | - $column = trim($column); |
|
| 29 | + $column = trim( $column ); |
|
| 30 | 30 | |
| 31 | - if (!$this->validateColumn($column, $allowedColumns)) |
|
| 32 | - throw new QueryException('Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME); |
|
| 31 | + if ( !$this->validateColumn( $column, $allowedColumns ) ) |
|
| 32 | + throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
|
| 33 | 33 | |
| 34 | - $this->queryStructure->setElement(QueryStructure::GROUP_BY, $column); |
|
| 34 | + $this->queryStructure->setElement( QueryStructure::GROUP_BY, $column ); |
|
| 35 | 35 | |
| 36 | 36 | return $this; |
| 37 | 37 | } |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | * @return $this |
| 44 | 44 | * @throws QueryException |
| 45 | 45 | */ |
| 46 | - public function groupByDesc($column, array $allowedColumns = []) |
|
| 46 | + public function groupByDesc( $column, array $allowedColumns = [ ] ) |
|
| 47 | 47 | { |
| 48 | - $column = trim($column); |
|
| 48 | + $column = trim( $column ); |
|
| 49 | 49 | |
| 50 | - if (!$this->validateColumn($column, $allowedColumns)) |
|
| 51 | - throw new QueryException('Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME); |
|
| 50 | + if ( !$this->validateColumn( $column, $allowedColumns ) ) |
|
| 51 | + throw new QueryException( 'Invalid column name in GROUP BY clause', QueryException::QUERY_ERROR_INVALID_COLUMN_NAME ); |
|
| 52 | 52 | |
| 53 | - $this->queryStructure->setElement(QueryStructure::GROUP_BY, $column . ' DESC'); |
|
| 53 | + $this->queryStructure->setElement( QueryStructure::GROUP_BY, $column . ' DESC' ); |
|
| 54 | 54 | |
| 55 | 55 | return $this; |
| 56 | 56 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param $expression |
| 61 | 61 | * @return $this |
| 62 | 62 | */ |
| 63 | - public function groupByExpression($expression) |
|
| 63 | + public function groupByExpression( $expression ) |
|
| 64 | 64 | { |
| 65 | - $this->queryStructure->setElement(QueryStructure::GROUP_BY, $expression); |
|
| 65 | + $this->queryStructure->setElement( QueryStructure::GROUP_BY, $expression ); |
|
| 66 | 66 | |
| 67 | 67 | return $this; |
| 68 | 68 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function getGroupBySyntax() |
| 75 | 75 | { |
| 76 | - if (count($this->queryStructure->getElement(QueryStructure::GROUP_BY))) |
|
| 77 | - return 'GROUP BY ' . QueryHelper::implode($this->queryStructure->getElement(QueryStructure::GROUP_BY), ', '); |
|
| 76 | + if ( count( $this->queryStructure->getElement( QueryStructure::GROUP_BY ) ) ) |
|
| 77 | + return 'GROUP BY ' . QueryHelper::implode( $this->queryStructure->getElement( QueryStructure::GROUP_BY ), ', ' ); |
|
| 78 | 78 | |
| 79 | 79 | return ''; |
| 80 | 80 | } |
@@ -23,30 +23,30 @@ |
||
| 23 | 23 | * @param int $withReplacement |
| 24 | 24 | * @return mixed|string |
| 25 | 25 | */ |
| 26 | - private function getSyntaxReplace($syntax, $withReplacement = QueryStatementInterface::REPLACEMENT_NONE) |
|
| 26 | + private function getSyntaxReplace( $syntax, $withReplacement = QueryStatementInterface::REPLACEMENT_NONE ) |
|
| 27 | 27 | { |
| 28 | - $syntax = QueryHelper::clearMultipleSpaces($syntax); |
|
| 28 | + $syntax = QueryHelper::clearMultipleSpaces( $syntax ); |
|
| 29 | 29 | |
| 30 | - if (!$withReplacement) |
|
| 30 | + if ( !$withReplacement ) |
|
| 31 | 31 | return $syntax; |
| 32 | 32 | |
| 33 | - return $this->replaceValues($syntax); |
|
| 33 | + return $this->replaceValues( $syntax ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param $syntax |
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | - private function replaceValues($syntax) |
|
| 40 | + private function replaceValues( $syntax ) |
|
| 41 | 41 | { |
| 42 | - $bindParams = $this->queryStructure->getElement(QueryStructure::BIND_PARAMS); |
|
| 42 | + $bindParams = $this->queryStructure->getElement( QueryStructure::BIND_PARAMS ); |
|
| 43 | 43 | $search = array(); |
| 44 | 44 | $replace = array(); |
| 45 | - foreach ($bindParams as $key => $value) { |
|
| 46 | - $search[] = ':' . $key; |
|
| 47 | - $replace[] = DbConnect::getInstance()->quote($value); |
|
| 45 | + foreach ( $bindParams as $key => $value ) { |
|
| 46 | + $search[ ] = ':' . $key; |
|
| 47 | + $replace[ ] = DbConnect::getInstance()->quote( $value ); |
|
| 48 | 48 | } |
| 49 | - $syntax = str_ireplace($search, $replace, $syntax); |
|
| 49 | + $syntax = str_ireplace( $search, $replace, $syntax ); |
|
| 50 | 50 | |
| 51 | 51 | return $syntax; |
| 52 | 52 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function all() |
| 25 | 25 | { |
| 26 | - $this->queryStructure->setElement(QueryStructure::DISTINCT, 0); |
|
| 26 | + $this->queryStructure->setElement( QueryStructure::DISTINCT, 0 ); |
|
| 27 | 27 | |
| 28 | 28 | return $this; |
| 29 | 29 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function distinct() |
| 35 | 35 | { |
| 36 | - $this->queryStructure->setElement(QueryStructure::DISTINCT, 1); |
|
| 36 | + $this->queryStructure->setElement( QueryStructure::DISTINCT, 1 ); |
|
| 37 | 37 | |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function distinctRow() |
| 45 | 45 | { |
| 46 | - $this->queryStructure->setElement(QueryStructure::DISTINCT, 2); |
|
| 46 | + $this->queryStructure->setElement( QueryStructure::DISTINCT, 2 ); |
|
| 47 | 47 | |
| 48 | 48 | return $this; |
| 49 | 49 | } |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | private function getDistinctSyntax() |
| 57 | 57 | { |
| 58 | - $useDistinct = $this->queryStructure->getElement(QueryStructure::DISTINCT); |
|
| 58 | + $useDistinct = $this->queryStructure->getElement( QueryStructure::DISTINCT ); |
|
| 59 | 59 | |
| 60 | - switch ($useDistinct) { |
|
| 60 | + switch ( $useDistinct ) { |
|
| 61 | 61 | case 0: |
| 62 | 62 | return ''; |
| 63 | 63 | case 1: |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | case 2: |
| 66 | 66 | return 'DISTINCTROW'; |
| 67 | 67 | default: |
| 68 | - throw new QueryException('Invalid distinct type', QueryException::QUERY_ERROR_INVALID_DISTINCT); |
|
| 68 | + throw new QueryException( 'Invalid distinct type', QueryException::QUERY_ERROR_INVALID_DISTINCT ); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function lowPriority() |
| 23 | 23 | { |
| 24 | - $this->queryStructure->setElement(QueryStructure::PRIORITY, 'LOW_PRIORITY'); |
|
| 24 | + $this->queryStructure->setElement( QueryStructure::PRIORITY, 'LOW_PRIORITY' ); |
|
| 25 | 25 | |
| 26 | 26 | return $this; |
| 27 | 27 | } |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * @param $fieldValue |
| 23 | 23 | * @return $this |
| 24 | 24 | */ |
| 25 | - public function setField($fieldName, $fieldValue) |
|
| 25 | + public function setField( $fieldName, $fieldValue ) |
|
| 26 | 26 | { |
| 27 | - $valuePdoString = $this->queryStructure->bindParam($fieldName, $fieldValue); |
|
| 28 | - $this->queryStructure->setElement(QueryStructure::SET_FIELDS, "$fieldName = $valuePdoString"); |
|
| 27 | + $valuePdoString = $this->queryStructure->bindParam( $fieldName, $fieldValue ); |
|
| 28 | + $this->queryStructure->setElement( QueryStructure::SET_FIELDS, "$fieldName = $valuePdoString" ); |
|
| 29 | 29 | |
| 30 | 30 | return $this; |
| 31 | 31 | } |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | * @param string $expression |
| 35 | 35 | * @return $this |
| 36 | 36 | */ |
| 37 | - public function setFieldByExpression($expression) |
|
| 37 | + public function setFieldByExpression( $expression ) |
|
| 38 | 38 | { |
| 39 | - $this->queryStructure->setElement(QueryStructure::SET_FIELDS, $expression); |
|
| 39 | + $this->queryStructure->setElement( QueryStructure::SET_FIELDS, $expression ); |
|
| 40 | 40 | |
| 41 | 41 | return $this; |
| 42 | 42 | } |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | * @param array $updateFieldsArray |
| 47 | 47 | * @return $this |
| 48 | 48 | */ |
| 49 | - public function setFieldsByArray(array $updateFieldsArray) |
|
| 49 | + public function setFieldsByArray( array $updateFieldsArray ) |
|
| 50 | 50 | { |
| 51 | - foreach ($updateFieldsArray as $fieldName => $fieldValue) |
|
| 52 | - $this->setField($fieldName, $fieldValue); |
|
| 51 | + foreach ( $updateFieldsArray as $fieldName => $fieldValue ) |
|
| 52 | + $this->setField( $fieldName, $fieldValue ); |
|
| 53 | 53 | |
| 54 | 54 | return $this; |
| 55 | 55 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function getSettingFieldsSyntax() |
| 61 | 61 | { |
| 62 | - if (!count($this->queryStructure->getElement(QueryStructure::SET_FIELDS))) |
|
| 62 | + if ( !count( $this->queryStructure->getElement( QueryStructure::SET_FIELDS ) ) ) |
|
| 63 | 63 | return ''; |
| 64 | 64 | |
| 65 | - return 'SET ' . implode(', ', $this->queryStructure->getElement(QueryStructure::SET_FIELDS)); |
|
| 65 | + return 'SET ' . implode( ', ', $this->queryStructure->getElement( QueryStructure::SET_FIELDS ) ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | \ No newline at end of file |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | * @param null $onRight |
| 24 | 24 | * @return $this |
| 25 | 25 | */ |
| 26 | - public function innerJoin($tableJoin, $onLeft, $onRight = null) |
|
| 26 | + public function innerJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 27 | 27 | { |
| 28 | - return $this->makeJoin('INNER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 28 | + return $this->makeJoin( 'INNER JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | * @param null $onRight |
| 35 | 35 | * @return $this |
| 36 | 36 | */ |
| 37 | - public function leftJoin($tableJoin, $onLeft, $onRight = null) |
|
| 37 | + public function leftJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 38 | 38 | { |
| 39 | - return $this->makeJoin('LEFT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 39 | + return $this->makeJoin( 'LEFT JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @param null $onRight |
| 46 | 46 | * @return $this |
| 47 | 47 | */ |
| 48 | - public function leftOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 48 | + public function leftOuterJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 49 | 49 | { |
| 50 | - return $this->makeJoin('LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 50 | + return $this->makeJoin( 'LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | * @param null $onRight |
| 57 | 57 | * @return $this |
| 58 | 58 | */ |
| 59 | - public function rightJoin($tableJoin, $onLeft, $onRight = null) |
|
| 59 | + public function rightJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 60 | 60 | { |
| 61 | - return $this->makeJoin('RIGHT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 61 | + return $this->makeJoin( 'RIGHT JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param null $onRight |
| 68 | 68 | * @return $this |
| 69 | 69 | */ |
| 70 | - public function rightOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 70 | + public function rightOuterJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 71 | 71 | { |
| 72 | - return $this->makeJoin('RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 72 | + return $this->makeJoin( 'RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @param null $onRight |
| 79 | 79 | * @return $this |
| 80 | 80 | */ |
| 81 | - public function fullJoin($tableJoin, $onLeft, $onRight = null) |
|
| 81 | + public function fullJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 82 | 82 | { |
| 83 | - return $this->makeJoin('FULL JOIN', $tableJoin, $onLeft, $onRight); |
|
| 83 | + return $this->makeJoin( 'FULL JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -89,18 +89,18 @@ discard block |
||
| 89 | 89 | * @param null $onRight |
| 90 | 90 | * @return $this |
| 91 | 91 | */ |
| 92 | - public function fullOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 92 | + public function fullOuterJoin( $tableJoin, $onLeft, $onRight = null ) |
|
| 93 | 93 | { |
| 94 | - return $this->makeJoin('FULL OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 94 | + return $this->makeJoin( 'FULL OUTER JOIN', $tableJoin, $onLeft, $onRight ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param $stringJoin |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function join($stringJoin) |
|
| 101 | + public function join( $stringJoin ) |
|
| 102 | 102 | { |
| 103 | - $this->queryStructure->setElement(QueryStructure::JOIN, $stringJoin); |
|
| 103 | + $this->queryStructure->setElement( QueryStructure::JOIN, $stringJoin ); |
|
| 104 | 104 | |
| 105 | 105 | return $this; |
| 106 | 106 | } |
@@ -112,15 +112,15 @@ discard block |
||
| 112 | 112 | * @param null $onRight |
| 113 | 113 | * @return $this |
| 114 | 114 | */ |
| 115 | - private function makeJoin($typeJoin, $tableJoin, $onLeft, $onRight = null) |
|
| 115 | + private function makeJoin( $typeJoin, $tableJoin, $onLeft, $onRight = null ) |
|
| 116 | 116 | { |
| 117 | 117 | $join = $typeJoin . ' ' . $tableJoin; |
| 118 | 118 | |
| 119 | - if (is_null($onRight)) |
|
| 119 | + if ( is_null( $onRight ) ) |
|
| 120 | 120 | $join .= " USING ( $onLeft )"; else |
| 121 | 121 | $join .= " ON $onLeft = $onRight"; |
| 122 | 122 | |
| 123 | - $this->queryStructure->setElement(QueryStructure::JOIN, $join); |
|
| 123 | + $this->queryStructure->setElement( QueryStructure::JOIN, $join ); |
|
| 124 | 124 | |
| 125 | 125 | return $this; |
| 126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | private function getJoinSyntax() |
| 132 | 132 | { |
| 133 | - $joinString = implode(' ', $this->queryStructure->getElement(QueryStructure::JOIN)); |
|
| 133 | + $joinString = implode( ' ', $this->queryStructure->getElement( QueryStructure::JOIN ) ); |
|
| 134 | 134 | |
| 135 | - return QueryHelper::clearMultipleSpaces($joinString); |
|
| 135 | + return QueryHelper::clearMultipleSpaces( $joinString ); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | \ No newline at end of file |