Skip to content

Commit

Permalink
Revue de code.
Browse files Browse the repository at this point in the history
  • Loading branch information
noelma committed Mar 14, 2021
1 parent 555fa97 commit d3494af
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Expand Up @@ -2,6 +2,7 @@

/* friendsofphp/php-cs-fixer: 1.13.* */
$finder = PhpCsFixer\Finder::create()
->exclude('build')
->in(__DIR__);

return PhpCsFixer\Config::create()
Expand Down
14 changes: 7 additions & 7 deletions src/Request.php
Expand Up @@ -147,17 +147,17 @@ public function __toString()
* @param string $name Nom de la méthode appelée.
* @param array $arg Pararètre de la méthode.
*
* @throws \BadMethodCallException
* @return $this
* @throws BadMethodCallException
*/
public function __call( $name, $arg )
public function __call($name, $arg)
{
if( method_exists($this->where, $name) ) {
throw new BadMethodCallException("The $name method not exist");
}
if( $this->where === null ) {
if ($this->where === null) {
$this->where = new Where();
}
if (!method_exists($this->where, $name)) {
throw new \BadMethodCallException("The $name method not exist");
}

call_user_func_array([ $this->where, $name ], $arg);

Expand Down Expand Up @@ -440,7 +440,7 @@ protected function executeJoins($type, $table, Where $where)
* @param array $data Données à trier.
* @param array $orderBy Clés sur lesquelles le trie s'exécute.
*
* @return array les données triées
* @return void
*/
protected function executeOrderBy(array &$data, array $orderBy)
{
Expand Down
4 changes: 3 additions & 1 deletion src/WhereHandler.php
Expand Up @@ -82,7 +82,7 @@ public function where(

return $this;
}
if ($value === null) {
if ($operator !== null && $value === null) {
list($value, $operator) = [ $operator, '=' ];
}

Expand Down Expand Up @@ -467,6 +467,8 @@ protected function whereCallback(\Closure $column, $bool = self::EXP_AND, $not =
* @param string $operator
* @param string $value
* @param string $bool
*
* @return void
*/
protected function like($column, $operator, $value, $bool = self::EXP_AND)
{
Expand Down

0 comments on commit d3494af

Please sign in to comment.