@@ -13,56 +13,56 @@ |
||
| 13 | 13 | trait SetFields |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - use Objects; |
|
| 16 | + use Objects; |
|
| 17 | 17 | |
| 18 | - private $setValues; |
|
| 18 | + private $setValues; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @param $fieldName |
|
| 22 | - * @param $fieldValue |
|
| 23 | - * @return $this |
|
| 24 | - */ |
|
| 25 | - public function setField($fieldName, $fieldValue) |
|
| 26 | - { |
|
| 27 | - $valuePdoString = $this->queryStructure->bindParam($fieldName, $fieldValue); |
|
| 28 | - $this->queryStructure->setElement(QueryStructure::SET_FIELDS, "$fieldName = $valuePdoString"); |
|
| 20 | + /** |
|
| 21 | + * @param $fieldName |
|
| 22 | + * @param $fieldValue |
|
| 23 | + * @return $this |
|
| 24 | + */ |
|
| 25 | + public function setField($fieldName, $fieldValue) |
|
| 26 | + { |
|
| 27 | + $valuePdoString = $this->queryStructure->bindParam($fieldName, $fieldValue); |
|
| 28 | + $this->queryStructure->setElement(QueryStructure::SET_FIELDS, "$fieldName = $valuePdoString"); |
|
| 29 | 29 | |
| 30 | - return $this; |
|
| 31 | - } |
|
| 30 | + return $this; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @param string $expression |
|
| 35 | - * @return $this |
|
| 36 | - */ |
|
| 37 | - public function setFieldByExpression($expression) |
|
| 38 | - { |
|
| 39 | - $this->queryStructure->setElement(QueryStructure::SET_FIELDS, $expression); |
|
| 33 | + /** |
|
| 34 | + * @param string $expression |
|
| 35 | + * @return $this |
|
| 36 | + */ |
|
| 37 | + public function setFieldByExpression($expression) |
|
| 38 | + { |
|
| 39 | + $this->queryStructure->setElement(QueryStructure::SET_FIELDS, $expression); |
|
| 40 | 40 | |
| 41 | - return $this; |
|
| 42 | - } |
|
| 41 | + return $this; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Set fields by associative array ( fieldName => fieldValue ) |
|
| 46 | - * @param array $updateFieldsArray |
|
| 47 | - * @return $this |
|
| 48 | - */ |
|
| 49 | - public function setFieldsByArray(array $updateFieldsArray) |
|
| 50 | - { |
|
| 51 | - foreach ($updateFieldsArray as $fieldName => $fieldValue) |
|
| 52 | - $this->setField($fieldName, $fieldValue); |
|
| 44 | + /** |
|
| 45 | + * Set fields by associative array ( fieldName => fieldValue ) |
|
| 46 | + * @param array $updateFieldsArray |
|
| 47 | + * @return $this |
|
| 48 | + */ |
|
| 49 | + public function setFieldsByArray(array $updateFieldsArray) |
|
| 50 | + { |
|
| 51 | + foreach ($updateFieldsArray as $fieldName => $fieldValue) |
|
| 52 | + $this->setField($fieldName, $fieldValue); |
|
| 53 | 53 | |
| 54 | - return $this; |
|
| 55 | - } |
|
| 54 | + return $this; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 60 | - private function getSettingFieldsSyntax() |
|
| 61 | - { |
|
| 62 | - if (!count($this->queryStructure->getElement(QueryStructure::SET_FIELDS))) |
|
| 63 | - return ''; |
|
| 57 | + /** |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | + private function getSettingFieldsSyntax() |
|
| 61 | + { |
|
| 62 | + if (!count($this->queryStructure->getElement(QueryStructure::SET_FIELDS))) |
|
| 63 | + return ''; |
|
| 64 | 64 | |
| 65 | - return 'SET ' . implode(', ', $this->queryStructure->getElement(QueryStructure::SET_FIELDS)); |
|
| 66 | - } |
|
| 65 | + return 'SET ' . implode(', ', $this->queryStructure->getElement(QueryStructure::SET_FIELDS)); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | } |
| 69 | 69 | \ No newline at end of file |
@@ -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 |
@@ -48,8 +48,9 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 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 | 55 | return $this; |
| 55 | 56 | } |
@@ -59,8 +60,9 @@ discard block |
||
| 59 | 60 | */ |
| 60 | 61 | private function getSettingFieldsSyntax() |
| 61 | 62 | { |
| 62 | - if (!count($this->queryStructure->getElement(QueryStructure::SET_FIELDS))) |
|
| 63 | - return ''; |
|
| 63 | + if (!count($this->queryStructure->getElement(QueryStructure::SET_FIELDS))) { |
|
| 64 | + return ''; |
|
| 65 | + } |
|
| 64 | 66 | |
| 65 | 67 | return 'SET ' . implode(', ', $this->queryStructure->getElement(QueryStructure::SET_FIELDS)); |
| 66 | 68 | } |
@@ -14,125 +14,125 @@ |
||
| 14 | 14 | trait Join |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - use Objects; |
|
| 18 | - |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @param $tableJoin |
|
| 22 | - * @param $onLeft |
|
| 23 | - * @param null $onRight |
|
| 24 | - * @return $this |
|
| 25 | - */ |
|
| 26 | - public function innerJoin($tableJoin, $onLeft, $onRight = null) |
|
| 27 | - { |
|
| 28 | - return $this->makeJoin('INNER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @param $tableJoin |
|
| 33 | - * @param $onLeft |
|
| 34 | - * @param null $onRight |
|
| 35 | - * @return $this |
|
| 36 | - */ |
|
| 37 | - public function leftJoin($tableJoin, $onLeft, $onRight = null) |
|
| 38 | - { |
|
| 39 | - return $this->makeJoin('LEFT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @param $tableJoin |
|
| 44 | - * @param $onLeft |
|
| 45 | - * @param null $onRight |
|
| 46 | - * @return $this |
|
| 47 | - */ |
|
| 48 | - public function leftOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 49 | - { |
|
| 50 | - return $this->makeJoin('LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @param $tableJoin |
|
| 55 | - * @param $onLeft |
|
| 56 | - * @param null $onRight |
|
| 57 | - * @return $this |
|
| 58 | - */ |
|
| 59 | - public function rightJoin($tableJoin, $onLeft, $onRight = null) |
|
| 60 | - { |
|
| 61 | - return $this->makeJoin('RIGHT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * @param $tableJoin |
|
| 66 | - * @param $onLeft |
|
| 67 | - * @param null $onRight |
|
| 68 | - * @return $this |
|
| 69 | - */ |
|
| 70 | - public function rightOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 71 | - { |
|
| 72 | - return $this->makeJoin('RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @param $tableJoin |
|
| 77 | - * @param $onLeft |
|
| 78 | - * @param null $onRight |
|
| 79 | - * @return $this |
|
| 80 | - */ |
|
| 81 | - public function fullJoin($tableJoin, $onLeft, $onRight = null) |
|
| 82 | - { |
|
| 83 | - return $this->makeJoin('FULL JOIN', $tableJoin, $onLeft, $onRight); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @param $tableJoin |
|
| 88 | - * @param $onLeft |
|
| 89 | - * @param null $onRight |
|
| 90 | - * @return $this |
|
| 91 | - */ |
|
| 92 | - public function fullOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 93 | - { |
|
| 94 | - return $this->makeJoin('FULL OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @param $stringJoin |
|
| 99 | - * @return $this |
|
| 100 | - */ |
|
| 101 | - public function join($stringJoin) |
|
| 102 | - { |
|
| 103 | - $this->queryStructure->setElement(QueryStructure::JOIN, $stringJoin); |
|
| 104 | - |
|
| 105 | - return $this; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** |
|
| 109 | - * @param $typeJoin |
|
| 110 | - * @param $tableJoin |
|
| 111 | - * @param $onLeft |
|
| 112 | - * @param null $onRight |
|
| 113 | - * @return $this |
|
| 114 | - */ |
|
| 115 | - private function makeJoin($typeJoin, $tableJoin, $onLeft, $onRight = null) |
|
| 116 | - { |
|
| 117 | - $join = $typeJoin . ' ' . $tableJoin; |
|
| 118 | - |
|
| 119 | - if (is_null($onRight)) |
|
| 120 | - $join .= " USING ( $onLeft )"; else |
|
| 121 | - $join .= " ON $onLeft = $onRight"; |
|
| 122 | - |
|
| 123 | - $this->queryStructure->setElement(QueryStructure::JOIN, $join); |
|
| 124 | - |
|
| 125 | - return $this; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * @return string |
|
| 130 | - */ |
|
| 131 | - private function getJoinSyntax() |
|
| 132 | - { |
|
| 133 | - $joinString = implode(' ', $this->queryStructure->getElement(QueryStructure::JOIN)); |
|
| 134 | - |
|
| 135 | - return QueryHelper::clearMultipleSpaces($joinString); |
|
| 136 | - } |
|
| 17 | + use Objects; |
|
| 18 | + |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @param $tableJoin |
|
| 22 | + * @param $onLeft |
|
| 23 | + * @param null $onRight |
|
| 24 | + * @return $this |
|
| 25 | + */ |
|
| 26 | + public function innerJoin($tableJoin, $onLeft, $onRight = null) |
|
| 27 | + { |
|
| 28 | + return $this->makeJoin('INNER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param $tableJoin |
|
| 33 | + * @param $onLeft |
|
| 34 | + * @param null $onRight |
|
| 35 | + * @return $this |
|
| 36 | + */ |
|
| 37 | + public function leftJoin($tableJoin, $onLeft, $onRight = null) |
|
| 38 | + { |
|
| 39 | + return $this->makeJoin('LEFT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @param $tableJoin |
|
| 44 | + * @param $onLeft |
|
| 45 | + * @param null $onRight |
|
| 46 | + * @return $this |
|
| 47 | + */ |
|
| 48 | + public function leftOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 49 | + { |
|
| 50 | + return $this->makeJoin('LEFT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @param $tableJoin |
|
| 55 | + * @param $onLeft |
|
| 56 | + * @param null $onRight |
|
| 57 | + * @return $this |
|
| 58 | + */ |
|
| 59 | + public function rightJoin($tableJoin, $onLeft, $onRight = null) |
|
| 60 | + { |
|
| 61 | + return $this->makeJoin('RIGHT JOIN', $tableJoin, $onLeft, $onRight); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * @param $tableJoin |
|
| 66 | + * @param $onLeft |
|
| 67 | + * @param null $onRight |
|
| 68 | + * @return $this |
|
| 69 | + */ |
|
| 70 | + public function rightOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 71 | + { |
|
| 72 | + return $this->makeJoin('RIGHT OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @param $tableJoin |
|
| 77 | + * @param $onLeft |
|
| 78 | + * @param null $onRight |
|
| 79 | + * @return $this |
|
| 80 | + */ |
|
| 81 | + public function fullJoin($tableJoin, $onLeft, $onRight = null) |
|
| 82 | + { |
|
| 83 | + return $this->makeJoin('FULL JOIN', $tableJoin, $onLeft, $onRight); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @param $tableJoin |
|
| 88 | + * @param $onLeft |
|
| 89 | + * @param null $onRight |
|
| 90 | + * @return $this |
|
| 91 | + */ |
|
| 92 | + public function fullOuterJoin($tableJoin, $onLeft, $onRight = null) |
|
| 93 | + { |
|
| 94 | + return $this->makeJoin('FULL OUTER JOIN', $tableJoin, $onLeft, $onRight); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @param $stringJoin |
|
| 99 | + * @return $this |
|
| 100 | + */ |
|
| 101 | + public function join($stringJoin) |
|
| 102 | + { |
|
| 103 | + $this->queryStructure->setElement(QueryStructure::JOIN, $stringJoin); |
|
| 104 | + |
|
| 105 | + return $this; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** |
|
| 109 | + * @param $typeJoin |
|
| 110 | + * @param $tableJoin |
|
| 111 | + * @param $onLeft |
|
| 112 | + * @param null $onRight |
|
| 113 | + * @return $this |
|
| 114 | + */ |
|
| 115 | + private function makeJoin($typeJoin, $tableJoin, $onLeft, $onRight = null) |
|
| 116 | + { |
|
| 117 | + $join = $typeJoin . ' ' . $tableJoin; |
|
| 118 | + |
|
| 119 | + if (is_null($onRight)) |
|
| 120 | + $join .= " USING ( $onLeft )"; else |
|
| 121 | + $join .= " ON $onLeft = $onRight"; |
|
| 122 | + |
|
| 123 | + $this->queryStructure->setElement(QueryStructure::JOIN, $join); |
|
| 124 | + |
|
| 125 | + return $this; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @return string |
|
| 130 | + */ |
|
| 131 | + private function getJoinSyntax() |
|
| 132 | + { |
|
| 133 | + $joinString = implode(' ', $this->queryStructure->getElement(QueryStructure::JOIN)); |
|
| 134 | + |
|
| 135 | + return QueryHelper::clearMultipleSpaces($joinString); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | \ 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 |
@@ -116,9 +116,11 @@ |
||
| 116 | 116 | { |
| 117 | 117 | $join = $typeJoin . ' ' . $tableJoin; |
| 118 | 118 | |
| 119 | - if (is_null($onRight)) |
|
| 120 | - $join .= " USING ( $onLeft )"; else |
|
| 121 | - $join .= " ON $onLeft = $onRight"; |
|
| 119 | + if (is_null($onRight)) { |
|
| 120 | + $join .= " USING ( $onLeft )"; |
|
| 121 | + } else { |
|
| 122 | + $join .= " ON $onLeft = $onRight"; |
|
| 123 | + } |
|
| 122 | 124 | |
| 123 | 125 | $this->queryStructure->setElement(QueryStructure::JOIN, $join); |
| 124 | 126 | |
@@ -18,52 +18,52 @@ |
||
| 18 | 18 | trait TableValidation |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - private function validateTable($table) |
|
| 22 | - { |
|
| 23 | - switch (gettype($table)) { |
|
| 24 | - |
|
| 25 | - case QueryStructure::ELEMENT_TYPE_STRING: |
|
| 26 | - $table = $this->validateTableName($table); |
|
| 27 | - break; |
|
| 28 | - case QueryStructure::ELEMENT_TYPE_OBJECT: |
|
| 29 | - $table = $this->validateTableSubQuery($table); |
|
| 30 | - break; |
|
| 31 | - default: |
|
| 32 | - throw new QueryException('Invalid table type parameter: ' . gettype($table), QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 33 | - |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - return $table; |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @param $table |
|
| 41 | - * @return mixed|string |
|
| 42 | - * @throws QueryException |
|
| 43 | - */ |
|
| 44 | - private function validateTableName($table) |
|
| 45 | - { |
|
| 46 | - $table = trim($table); |
|
| 47 | - |
|
| 48 | - if ('' === $table) |
|
| 49 | - throw new QueryException('Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 50 | - |
|
| 51 | - if (DbConfig::getInstance()->useTablePrefix()) |
|
| 52 | - $table = str_ireplace('::', DbConfig::getInstance()->getTablePrefix(), $table); |
|
| 53 | - |
|
| 54 | - return $table; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - private function validateTableSubQuery($table) |
|
| 58 | - { |
|
| 59 | - if ($this->statement !== QueryStatement::QUERY_STATEMENT_SELECT) |
|
| 60 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 61 | - |
|
| 62 | - if (!is_a($table, QuerySelect::class)) |
|
| 63 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 64 | - |
|
| 65 | - return $table; |
|
| 66 | - } |
|
| 21 | + private function validateTable($table) |
|
| 22 | + { |
|
| 23 | + switch (gettype($table)) { |
|
| 24 | + |
|
| 25 | + case QueryStructure::ELEMENT_TYPE_STRING: |
|
| 26 | + $table = $this->validateTableName($table); |
|
| 27 | + break; |
|
| 28 | + case QueryStructure::ELEMENT_TYPE_OBJECT: |
|
| 29 | + $table = $this->validateTableSubQuery($table); |
|
| 30 | + break; |
|
| 31 | + default: |
|
| 32 | + throw new QueryException('Invalid table type parameter: ' . gettype($table), QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 33 | + |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + return $table; |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @param $table |
|
| 41 | + * @return mixed|string |
|
| 42 | + * @throws QueryException |
|
| 43 | + */ |
|
| 44 | + private function validateTableName($table) |
|
| 45 | + { |
|
| 46 | + $table = trim($table); |
|
| 47 | + |
|
| 48 | + if ('' === $table) |
|
| 49 | + throw new QueryException('Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 50 | + |
|
| 51 | + if (DbConfig::getInstance()->useTablePrefix()) |
|
| 52 | + $table = str_ireplace('::', DbConfig::getInstance()->getTablePrefix(), $table); |
|
| 53 | + |
|
| 54 | + return $table; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + private function validateTableSubQuery($table) |
|
| 58 | + { |
|
| 59 | + if ($this->statement !== QueryStatement::QUERY_STATEMENT_SELECT) |
|
| 60 | + throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 61 | + |
|
| 62 | + if (!is_a($table, QuerySelect::class)) |
|
| 63 | + throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 64 | + |
|
| 65 | + return $table; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -18,18 +18,18 @@ discard block |
||
| 18 | 18 | trait TableValidation |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - private function validateTable($table) |
|
| 21 | + private function validateTable( $table ) |
|
| 22 | 22 | { |
| 23 | - switch (gettype($table)) { |
|
| 23 | + switch ( gettype( $table ) ) { |
|
| 24 | 24 | |
| 25 | 25 | case QueryStructure::ELEMENT_TYPE_STRING: |
| 26 | - $table = $this->validateTableName($table); |
|
| 26 | + $table = $this->validateTableName( $table ); |
|
| 27 | 27 | break; |
| 28 | 28 | case QueryStructure::ELEMENT_TYPE_OBJECT: |
| 29 | - $table = $this->validateTableSubQuery($table); |
|
| 29 | + $table = $this->validateTableSubQuery( $table ); |
|
| 30 | 30 | break; |
| 31 | 31 | default: |
| 32 | - throw new QueryException('Invalid table type parameter: ' . gettype($table), QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 32 | + throw new QueryException( 'Invalid table type parameter: ' . gettype( $table ), QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT ); |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -41,26 +41,26 @@ discard block |
||
| 41 | 41 | * @return mixed|string |
| 42 | 42 | * @throws QueryException |
| 43 | 43 | */ |
| 44 | - private function validateTableName($table) |
|
| 44 | + private function validateTableName( $table ) |
|
| 45 | 45 | { |
| 46 | - $table = trim($table); |
|
| 46 | + $table = trim( $table ); |
|
| 47 | 47 | |
| 48 | - if ('' === $table) |
|
| 49 | - throw new QueryException('Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 48 | + if ( '' === $table ) |
|
| 49 | + throw new QueryException( 'Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT ); |
|
| 50 | 50 | |
| 51 | - if (DbConfig::getInstance()->useTablePrefix()) |
|
| 52 | - $table = str_ireplace('::', DbConfig::getInstance()->getTablePrefix(), $table); |
|
| 51 | + if ( DbConfig::getInstance()->useTablePrefix() ) |
|
| 52 | + $table = str_ireplace( '::', DbConfig::getInstance()->getTablePrefix(), $table ); |
|
| 53 | 53 | |
| 54 | 54 | return $table; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - private function validateTableSubQuery($table) |
|
| 57 | + private function validateTableSubQuery( $table ) |
|
| 58 | 58 | { |
| 59 | - if ($this->statement !== QueryStatement::QUERY_STATEMENT_SELECT) |
|
| 60 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 59 | + if ( $this->statement !== QueryStatement::QUERY_STATEMENT_SELECT ) |
|
| 60 | + throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT ); |
|
| 61 | 61 | |
| 62 | - if (!is_a($table, QuerySelect::class)) |
|
| 63 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 62 | + if ( !is_a( $table, QuerySelect::class ) ) |
|
| 63 | + throw new QueryException( 'Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT ); |
|
| 64 | 64 | |
| 65 | 65 | return $table; |
| 66 | 66 | } |
@@ -45,22 +45,26 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $table = trim($table); |
| 47 | 47 | |
| 48 | - if ('' === $table) |
|
| 49 | - throw new QueryException('Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 48 | + if ('' === $table) { |
|
| 49 | + throw new QueryException('Table name is empty string!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | - if (DbConfig::getInstance()->useTablePrefix()) |
|
| 52 | - $table = str_ireplace('::', DbConfig::getInstance()->getTablePrefix(), $table); |
|
| 52 | + if (DbConfig::getInstance()->useTablePrefix()) { |
|
| 53 | + $table = str_ireplace('::', DbConfig::getInstance()->getTablePrefix(), $table); |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | return $table; |
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | private function validateTableSubQuery($table) |
| 58 | 60 | { |
| 59 | - if ($this->statement !== QueryStatement::QUERY_STATEMENT_SELECT) |
|
| 60 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 61 | + if ($this->statement !== QueryStatement::QUERY_STATEMENT_SELECT) { |
|
| 62 | + throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 63 | + } |
|
| 61 | 64 | |
| 62 | - if (!is_a($table, QuerySelect::class)) |
|
| 63 | - throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 65 | + if (!is_a($table, QuerySelect::class)) { |
|
| 66 | + throw new QueryException('Invalid subQuery statement!', QueryException::QUERY_ERROR_INVALID_TABLE_STATEMENT); |
|
| 67 | + } |
|
| 64 | 68 | |
| 65 | 69 | return $table; |
| 66 | 70 | } |
@@ -15,48 +15,48 @@ |
||
| 15 | 15 | trait Limit |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - use Objects; |
|
| 18 | + use Objects; |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param int $limit |
|
| 23 | - * @param null $offset |
|
| 24 | - * @return $this |
|
| 25 | - * @throws QueryException |
|
| 26 | - */ |
|
| 27 | - public function limit($limit = 0, $offset = null) |
|
| 28 | - { |
|
| 29 | - $limit = trim($limit); |
|
| 21 | + /** |
|
| 22 | + * @param int $limit |
|
| 23 | + * @param null $offset |
|
| 24 | + * @return $this |
|
| 25 | + * @throws QueryException |
|
| 26 | + */ |
|
| 27 | + public function limit($limit = 0, $offset = null) |
|
| 28 | + { |
|
| 29 | + $limit = trim($limit); |
|
| 30 | 30 | |
| 31 | - if (!QueryHelper::isInteger($limit)) |
|
| 32 | - throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT); |
|
| 31 | + if (!QueryHelper::isInteger($limit)) |
|
| 32 | + throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT); |
|
| 33 | 33 | |
| 34 | - if ($limit == 0) |
|
| 35 | - throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO); |
|
| 34 | + if ($limit == 0) |
|
| 35 | + throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO); |
|
| 36 | 36 | |
| 37 | - if (is_null($offset)) { |
|
| 38 | - $this->queryStructure->setElement(QueryStructure::LIMIT, $limit); |
|
| 37 | + if (is_null($offset)) { |
|
| 38 | + $this->queryStructure->setElement(QueryStructure::LIMIT, $limit); |
|
| 39 | 39 | |
| 40 | - return $this; |
|
| 41 | - } |
|
| 40 | + return $this; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $offset = trim($offset); |
|
| 43 | + $offset = trim($offset); |
|
| 44 | 44 | |
| 45 | - if (!QueryHelper::isInteger($offset)) |
|
| 46 | - throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET); |
|
| 45 | + if (!QueryHelper::isInteger($offset)) |
|
| 46 | + throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET); |
|
| 47 | 47 | |
| 48 | - $this->queryStructure->setElement(QueryStructure::LIMIT, $offset . ',' . $limit); |
|
| 48 | + $this->queryStructure->setElement(QueryStructure::LIMIT, $offset . ',' . $limit); |
|
| 49 | 49 | |
| 50 | - return $this; |
|
| 51 | - } |
|
| 50 | + return $this; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - private function getLimitSyntax() |
|
| 54 | - { |
|
| 55 | - if (!$this->queryStructure->getElement(QueryStructure::LIMIT)) |
|
| 56 | - return ''; |
|
| 53 | + private function getLimitSyntax() |
|
| 54 | + { |
|
| 55 | + if (!$this->queryStructure->getElement(QueryStructure::LIMIT)) |
|
| 56 | + return ''; |
|
| 57 | 57 | |
| 58 | - return 'LIMIT ' . $this->queryStructure->getElement(QueryStructure::LIMIT); |
|
| 59 | - } |
|
| 58 | + return 'LIMIT ' . $this->queryStructure->getElement(QueryStructure::LIMIT); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -24,38 +24,38 @@ |
||
| 24 | 24 | * @return $this |
| 25 | 25 | * @throws QueryException |
| 26 | 26 | */ |
| 27 | - public function limit($limit = 0, $offset = null) |
|
| 27 | + public function limit( $limit = 0, $offset = null ) |
|
| 28 | 28 | { |
| 29 | - $limit = trim($limit); |
|
| 29 | + $limit = trim( $limit ); |
|
| 30 | 30 | |
| 31 | - if (!QueryHelper::isInteger($limit)) |
|
| 32 | - throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT); |
|
| 31 | + if ( !QueryHelper::isInteger( $limit ) ) |
|
| 32 | + throw new QueryException( 'Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT ); |
|
| 33 | 33 | |
| 34 | - if ($limit == 0) |
|
| 35 | - throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO); |
|
| 34 | + if ( $limit == 0 ) |
|
| 35 | + throw new QueryException( 'Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO ); |
|
| 36 | 36 | |
| 37 | - if (is_null($offset)) { |
|
| 38 | - $this->queryStructure->setElement(QueryStructure::LIMIT, $limit); |
|
| 37 | + if ( is_null( $offset ) ) { |
|
| 38 | + $this->queryStructure->setElement( QueryStructure::LIMIT, $limit ); |
|
| 39 | 39 | |
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $offset = trim($offset); |
|
| 43 | + $offset = trim( $offset ); |
|
| 44 | 44 | |
| 45 | - if (!QueryHelper::isInteger($offset)) |
|
| 46 | - throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET); |
|
| 45 | + if ( !QueryHelper::isInteger( $offset ) ) |
|
| 46 | + throw new QueryException( 'Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET ); |
|
| 47 | 47 | |
| 48 | - $this->queryStructure->setElement(QueryStructure::LIMIT, $offset . ',' . $limit); |
|
| 48 | + $this->queryStructure->setElement( QueryStructure::LIMIT, $offset . ',' . $limit ); |
|
| 49 | 49 | |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | private function getLimitSyntax() |
| 54 | 54 | { |
| 55 | - if (!$this->queryStructure->getElement(QueryStructure::LIMIT)) |
|
| 55 | + if ( !$this->queryStructure->getElement( QueryStructure::LIMIT ) ) |
|
| 56 | 56 | return ''; |
| 57 | 57 | |
| 58 | - return 'LIMIT ' . $this->queryStructure->getElement(QueryStructure::LIMIT); |
|
| 58 | + return 'LIMIT ' . $this->queryStructure->getElement( QueryStructure::LIMIT ); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | } |
@@ -28,11 +28,13 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $limit = trim($limit); |
| 30 | 30 | |
| 31 | - if (!QueryHelper::isInteger($limit)) |
|
| 32 | - throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT); |
|
| 31 | + if (!QueryHelper::isInteger($limit)) { |
|
| 32 | + throw new QueryException('Invalid Limit value', QueryException::QUERY_ERROR_INVALID_LIMIT); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | - if ($limit == 0) |
|
| 35 | - throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO); |
|
| 35 | + if ($limit == 0) { |
|
| 36 | + throw new QueryException('Invalid Limit zero', QueryException::QUERY_ERROR_INVALID_LIMIT_ZERO); |
|
| 37 | + } |
|
| 36 | 38 | |
| 37 | 39 | if (is_null($offset)) { |
| 38 | 40 | $this->queryStructure->setElement(QueryStructure::LIMIT, $limit); |
@@ -42,8 +44,9 @@ discard block |
||
| 42 | 44 | |
| 43 | 45 | $offset = trim($offset); |
| 44 | 46 | |
| 45 | - if (!QueryHelper::isInteger($offset)) |
|
| 46 | - throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET); |
|
| 47 | + if (!QueryHelper::isInteger($offset)) { |
|
| 48 | + throw new QueryException('Invalid Limit offset', QueryException::QUERY_ERROR_INVALID_LIMIT_OFFSET); |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | $this->queryStructure->setElement(QueryStructure::LIMIT, $offset . ',' . $limit); |
| 49 | 52 | |
@@ -52,8 +55,9 @@ discard block |
||
| 52 | 55 | |
| 53 | 56 | private function getLimitSyntax() |
| 54 | 57 | { |
| 55 | - if (!$this->queryStructure->getElement(QueryStructure::LIMIT)) |
|
| 56 | - return ''; |
|
| 58 | + if (!$this->queryStructure->getElement(QueryStructure::LIMIT)) { |
|
| 59 | + return ''; |
|
| 60 | + } |
|
| 57 | 61 | |
| 58 | 62 | return 'LIMIT ' . $this->queryStructure->getElement(QueryStructure::LIMIT); |
| 59 | 63 | } |
@@ -12,18 +12,18 @@ |
||
| 12 | 12 | trait ColumnValidation |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - use Objects; |
|
| 15 | + use Objects; |
|
| 16 | 16 | |
| 17 | - protected function validateColumn($columnName, array $allowed) |
|
| 18 | - { |
|
| 19 | - if (is_integer($columnName)) |
|
| 20 | - return true; |
|
| 17 | + protected function validateColumn($columnName, array $allowed) |
|
| 18 | + { |
|
| 19 | + if (is_integer($columnName)) |
|
| 20 | + return true; |
|
| 21 | 21 | |
| 22 | - if (!count($allowed)) |
|
| 23 | - return true; |
|
| 22 | + if (!count($allowed)) |
|
| 23 | + return true; |
|
| 24 | 24 | |
| 25 | - return false; |
|
| 26 | - } |
|
| 25 | + return false; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | |
| 15 | 15 | use Objects; |
| 16 | 16 | |
| 17 | - protected function validateColumn($columnName, array $allowed) |
|
| 17 | + protected function validateColumn( $columnName, array $allowed ) |
|
| 18 | 18 | { |
| 19 | - if (is_integer($columnName)) |
|
| 19 | + if ( is_integer( $columnName ) ) |
|
| 20 | 20 | return true; |
| 21 | 21 | |
| 22 | - if (!count($allowed)) |
|
| 22 | + if ( !count( $allowed ) ) |
|
| 23 | 23 | return true; |
| 24 | 24 | |
| 25 | 25 | return false; |
@@ -16,11 +16,13 @@ |
||
| 16 | 16 | |
| 17 | 17 | protected function validateColumn($columnName, array $allowed) |
| 18 | 18 | { |
| 19 | - if (is_integer($columnName)) |
|
| 20 | - return true; |
|
| 19 | + if (is_integer($columnName)) { |
|
| 20 | + return true; |
|
| 21 | + } |
|
| 21 | 22 | |
| 22 | - if (!count($allowed)) |
|
| 23 | - return true; |
|
| 23 | + if (!count($allowed)) { |
|
| 24 | + return true; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | 27 | return false; |
| 26 | 28 | } |
@@ -14,17 +14,17 @@ |
||
| 14 | 14 | trait Ignore |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - use Objects; |
|
| 17 | + use Objects; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @return $this |
|
| 21 | - */ |
|
| 22 | - public function ignore() |
|
| 23 | - { |
|
| 24 | - $this->queryStructure->setElement(QueryStructure::IGNORE, 1); |
|
| 19 | + /** |
|
| 20 | + * @return $this |
|
| 21 | + */ |
|
| 22 | + public function ignore() |
|
| 23 | + { |
|
| 24 | + $this->queryStructure->setElement(QueryStructure::IGNORE, 1); |
|
| 25 | 25 | |
| 26 | - return $this; |
|
| 27 | - } |
|
| 26 | + return $this; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function ignore() |
| 23 | 23 | { |
| 24 | - $this->queryStructure->setElement(QueryStructure::IGNORE, 1); |
|
| 24 | + $this->queryStructure->setElement( QueryStructure::IGNORE, 1 ); |
|
| 25 | 25 | |
| 26 | 26 | return $this; |
| 27 | 27 | } |
@@ -14,16 +14,16 @@ |
||
| 14 | 14 | trait HighPriority |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - use Objects; |
|
| 17 | + use Objects; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @return $this |
|
| 21 | - */ |
|
| 22 | - public function highPriority() |
|
| 23 | - { |
|
| 24 | - $this->queryStructure->setElement(QueryStructure::PRIORITY, 'HIGH_PRIORITY'); |
|
| 19 | + /** |
|
| 20 | + * @return $this |
|
| 21 | + */ |
|
| 22 | + public function highPriority() |
|
| 23 | + { |
|
| 24 | + $this->queryStructure->setElement(QueryStructure::PRIORITY, 'HIGH_PRIORITY'); |
|
| 25 | 25 | |
| 26 | - return $this; |
|
| 27 | - } |
|
| 26 | + return $this; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function highPriority() |
| 23 | 23 | { |
| 24 | - $this->queryStructure->setElement(QueryStructure::PRIORITY, 'HIGH_PRIORITY'); |
|
| 24 | + $this->queryStructure->setElement( QueryStructure::PRIORITY, 'HIGH_PRIORITY' ); |
|
| 25 | 25 | |
| 26 | 26 | return $this; |
| 27 | 27 | } |
@@ -14,17 +14,17 @@ |
||
| 14 | 14 | trait DefaultPriority |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - use Objects; |
|
| 17 | + use Objects; |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @return $this |
|
| 22 | - */ |
|
| 23 | - public function defaultPriority() |
|
| 24 | - { |
|
| 25 | - $this->queryStructure->setElement(QueryStructure::PRIORITY, ''); |
|
| 20 | + /** |
|
| 21 | + * @return $this |
|
| 22 | + */ |
|
| 23 | + public function defaultPriority() |
|
| 24 | + { |
|
| 25 | + $this->queryStructure->setElement(QueryStructure::PRIORITY, ''); |
|
| 26 | 26 | |
| 27 | - return $this; |
|
| 28 | - } |
|
| 27 | + return $this; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function defaultPriority() |
| 24 | 24 | { |
| 25 | - $this->queryStructure->setElement(QueryStructure::PRIORITY, ''); |
|
| 25 | + $this->queryStructure->setElement( QueryStructure::PRIORITY, '' ); |
|
| 26 | 26 | |
| 27 | 27 | return $this; |
| 28 | 28 | } |
@@ -11,23 +11,23 @@ |
||
| 11 | 11 | class QueryException extends \Exception |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - const QUERY_ERROR_ELEMENT_NOT_FOUND = 10; |
|
| 15 | - const QUERY_ERROR_ELEMENT_TYPE = 11; |
|
| 16 | - const QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY = 20; |
|
| 17 | - const QUERY_ERROR_WHERE_INVALID_OPERATOR = 30; |
|
| 18 | - const QUERY_ERROR_INVALID_LIMIT = 40; |
|
| 19 | - const QUERY_ERROR_INVALID_LIMIT_ZERO = 50; |
|
| 20 | - const QUERY_ERROR_INVALID_LIMIT_OFFSET = 60; |
|
| 21 | - const QUERY_ERROR_DELETE_NOT_FILTER = 70; |
|
| 14 | + const QUERY_ERROR_ELEMENT_NOT_FOUND = 10; |
|
| 15 | + const QUERY_ERROR_ELEMENT_TYPE = 11; |
|
| 16 | + const QUERY_ERROR_WHERE_INVALID_PARAM_ARRAY = 20; |
|
| 17 | + const QUERY_ERROR_WHERE_INVALID_OPERATOR = 30; |
|
| 18 | + const QUERY_ERROR_INVALID_LIMIT = 40; |
|
| 19 | + const QUERY_ERROR_INVALID_LIMIT_ZERO = 50; |
|
| 20 | + const QUERY_ERROR_INVALID_LIMIT_OFFSET = 60; |
|
| 21 | + const QUERY_ERROR_DELETE_NOT_FILTER = 70; |
|
| 22 | 22 | |
| 23 | - const QUERY_ERROR_INVALID_FIELDS_COUNT = 91; |
|
| 24 | - const QUERY_ERROR_INVALID_DISTINCT = 92; |
|
| 25 | - const QUERY_ERROR_HAVING_INVALID_PARAM_ARRAY = 93; |
|
| 26 | - const QUERY_ERROR_HAVING_INVALID_OPERATOR = 94; |
|
| 27 | - const QUERY_ERROR_SELECT_INVALID_FIELD = 95; |
|
| 28 | - const QUERY_ERROR_SELECT_INVALID_PARAM = 96; |
|
| 29 | - const QUERY_ERROR_INVALID_TABLE_STATEMENT = 97; |
|
| 30 | - const QUERY_ERROR_INVALID_COLUMN_NAME = 98; |
|
| 31 | - const QUERY_ERROR_INVALID_CONDITION_TYPE = 99; |
|
| 23 | + const QUERY_ERROR_INVALID_FIELDS_COUNT = 91; |
|
| 24 | + const QUERY_ERROR_INVALID_DISTINCT = 92; |
|
| 25 | + const QUERY_ERROR_HAVING_INVALID_PARAM_ARRAY = 93; |
|
| 26 | + const QUERY_ERROR_HAVING_INVALID_OPERATOR = 94; |
|
| 27 | + const QUERY_ERROR_SELECT_INVALID_FIELD = 95; |
|
| 28 | + const QUERY_ERROR_SELECT_INVALID_PARAM = 96; |
|
| 29 | + const QUERY_ERROR_INVALID_TABLE_STATEMENT = 97; |
|
| 30 | + const QUERY_ERROR_INVALID_COLUMN_NAME = 98; |
|
| 31 | + const QUERY_ERROR_INVALID_CONDITION_TYPE = 99; |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | \ No newline at end of file |