コード例 #1
0
 private function _makeDataArray($row)
 {
     $dataArray = [];
     foreach ($row as $keySnakeCase => $value) {
         $keyCamelCase = NamingConvention::snakeCaseToCamelCase($keySnakeCase);
         $definitions = $this->_structure[$keyCamelCase];
         switch ($definitions[0]) {
             case TYPE_INT:
             case TYPE_PRIMARY:
                 $dataArray[$keyCamelCase] = (int) $value;
                 break;
             case TYPE_FLOAT:
                 $dataArray[$keyCamelCase] = (double) $value;
                 break;
             case TYPE_STRING:
             case TYPE_TEXT:
             case TYPE_DATE_TIME:
             case TYPE_DATE:
             case TYPE_TIME:
                 $dataArray[$keyCamelCase] = stripslashes($value);
                 break;
             default:
                 $dataArray[$keyCamelCase] = stripslashes($value);
                 break;
         }
     }
     return $dataArray;
 }
コード例 #2
0
ファイル: object.php プロジェクト: RobinTheHood/php-framework
 public function loadFromPOST()
 {
     $post = $_POST;
     $array = array();
     foreach ($post as $key => $value) {
         $camelCaseKey = NamingConvention::snakeCaseToCamelCase($key);
         $array[$camelCaseKey] = $value;
     }
     $this->loadFromArray($array);
 }