Type hinting

This commit is contained in:
Timothy Warren 2012-03-05 14:34:51 -05:00
parent bcfc97a2c3
commit 82165aa903
2 changed files with 12 additions and 12 deletions

View File

@ -22,7 +22,7 @@ class db extends PDO {
private $statement; private $statement;
private static $instance = array(); private static $instance = array();
public static function &get_instance($dbname="default", $options=array()) public static function &get_instance($dbname="default", array $options=array())
{ {
if ( ! isset(self::$instance[$dbname])) if ( ! isset(self::$instance[$dbname]))
{ {
@ -42,7 +42,7 @@ class db extends PDO {
* @param array $options * @param array $options
* @return db object * @return db object
*/ */
private static function _get_conf($dbname="default", $options=array()) private static function _get_conf($dbname="default", array $options=array())
{ {
// Include the database config file // Include the database config file
require(APP_PATH.'config/db.php'); require(APP_PATH.'config/db.php');
@ -100,7 +100,7 @@ class db extends PDO {
* @param string $pass * @param string $pass
* @param array $options * @param array $options
*/ */
function __construct($dsn, $user, $pass, $options) function __construct($dsn, $user, $pass, array $options=array())
{ {
// Let's try connecting now! // Let's try connecting now!
parent::__construct($dsn, $user, $pass, $options); parent::__construct($dsn, $user, $pass, $options);
@ -115,7 +115,7 @@ class db extends PDO {
* @param string $name * @param string $name
* @param array $args * @param array $args
*/ */
function __call($name, $args) function __call($name, array $args)
{ {
if(is_callable($this->$name)) if(is_callable($this->$name))
{ {
@ -135,7 +135,7 @@ class db extends PDO {
* @param string $name * @param string $name
* @param array $args * @param array $args
*/ */
public static function __callStatic($name, $args) public static function __callStatic($name, array $args)
{ {
if(is_callable(parent::$name)) if(is_callable(parent::$name))
{ {
@ -150,7 +150,7 @@ class db extends PDO {
* *
* @return string * @return string
*/ */
function __toString() public function __toString()
{ {
if(ENVIRONMENT == 'DEVELOPMENT') if(ENVIRONMENT == 'DEVELOPMENT')
{ {
@ -201,7 +201,7 @@ class db extends PDO {
* @param array $data * @param array $data
* @return mixed PDOStatement / FALSE * @return mixed PDOStatement / FALSE
*/ */
function prepare_query($sql, $data) public function prepare_query($sql, $data)
{ {
// Prepare the sql // Prepare the sql
$query = $this->prepare($sql); $query = $this->prepare($sql);
@ -245,7 +245,7 @@ class db extends PDO {
* *
* @return string * @return string
*/ */
function get_last_error() public function get_last_error()
{ {
$error = array(); $error = array();

View File

@ -20,7 +20,7 @@ trait JSObject {
/** /**
* Constructor for creating the objects * Constructor for creating the objects
*/ */
public function __construct($members = array()) public function __construct(array $members = array())
{ {
// Add the passed parameters to the object // Add the passed parameters to the object
foreach($members as $name => $value) foreach($members as $name => $value)
@ -35,7 +35,7 @@ trait JSObject {
* @param string $name * @param string $name
* @param array $args * @param array $args
*/ */
public function __call($name, $args) public function __call($name, array $args)
{ {
if(is_callable($this->$name)) if(is_callable($this->$name))
{ {
@ -53,7 +53,7 @@ trait JSObject {
* @param string $name * @param string $name
* @param array $args * @param array $args
*/ */
public static function __callStatic($name, $args) public static function __callStatic($name, array $args)
{ {
if(is_callable(self::$name)) if(is_callable(self::$name))
{ {
@ -369,7 +369,7 @@ class MM_Controller extends miniMVC {
* @param array $data * @param array $data
* @return mixed * @return mixed
*/ */
function load_view($file, $data, $return=FALSE) function load_view($file, array $data=array(), $return=FALSE)
{ {
$path = ""; $path = "";