Пример #1
0
 /** 
  * Check if given input is of given type. 
  * @param mixed input 
  * @param string type 
  * @example isType('some text', 'string') - will return true 
  * @example isType('some text', 'object') - will return false  
  * @return boolean
  */
 public static function isType($input = false, $type = false)
 {
     if ($input && $type && Data::type($input) == $type) {
         return true;
     }
     return false;
 }
Пример #2
0
 /** 
  * Format anything into array. 
  * @param mixed input 
  * @return array 
  */
 public static function toArray($input = false)
 {
     if ($input) {
         switch (Data::type($input)) {
             case 'array':
                 $array = $input;
                 break;
             case 'object':
                 $array = self::arrayToObject($input);
                 break;
         }
         if (Validate::isObject($input)) {
             return $input;
         }
     }
     return false;
 }