Last active
December 20, 2015 14:29
-
-
Save daviddeutsch/6147078 to your computer and use it in GitHub Desktop.
Cleanup Ex 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Original function | |
public function find($type, $sql = null, $bindings = array()) { | |
if ($sql instanceof RedBean_SQLHelper) list($sql, $bindings) = $sql->getQuery(); | |
if (!is_array($bindings)) throw new RedBean_Exception_Security('Expected array, ' . gettype($bindings) . ' given.'); | |
return $this->redbean->find($type, array(), $sql, $bindings); | |
} | |
// Split open Ifs, add whitespace, newlines | |
public function find( $type, $sql = null, $bindings = array() ) | |
{ | |
if ( $sql instanceof RedBean_SQLHelper ) { | |
list($sql, $bindings) = $sql->getQuery(); | |
} | |
if ( !is_array($bindings) ) { | |
throw new RedBean_Exception_Security('Expected array, ' . gettype($bindings) . ' given.'); | |
} | |
return $this->redbean->find($type, array(), $sql, $bindings); | |
} | |
// 80 char limit | |
public function find( $type, $sql = null, $bindings = array() ) | |
{ | |
if ( $sql instanceof RedBean_SQLHelper ) { | |
list($sql, $bindings) = $sql->getQuery(); | |
} | |
if ( !is_array($bindings) ) { | |
throw new RedBean_Exception_Security( | |
'Expected array, ' . gettype($bindings) . ' given.' | |
); | |
} | |
return $this->redbean->find($type, array(), $sql, $bindings); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment