Exakat\Data\Methods::getInternalParameterType PHP Метод

getInternalParameterType() публичный Метод

    public function getInternalParameterType()
    {
        $return = array();
        $args = array('arg0', 'arg1');
        foreach ($args as $id => $arg) {
            $query = <<<SQL
SELECT {$arg}, lower(GROUP_CONCAT('\\' || name)) AS functions FROM args_type WHERE class='PHP' AND {$arg} IN ('int', 'array', 'bool','string') GROUP BY {$arg}
SQL;
            $res = $this->sqlite->query($query);
            $position = array();
            while ($row = $res->fetchArray(\SQLITE3_ASSOC)) {
                $position[$row[$arg]] = explode(',', $row['functions']);
            }
            $return[$id] = $position;
        }
        return $return;
    }

Usage Example

Пример #1
0
 public function analyze()
 {
     $data = new Methods();
     $args = $data->getInternalParameterType();
     $typeConversion = array('string' => array('Magicconstant', 'Heredoc', 'String'), 'real' => 'Real', 'int' => 'Integer', 'numeric' => array('Real', 'Integer'), 'resource' => '', 'bool' => 'Boolean', 'array' => '', 'void' => 'Void', 'mixed' => '');
     foreach ($args as $position => $types) {
         foreach ($types as $type => $functions) {
             if (strpos($type, ',') !== false) {
                 continue;
                 // No support for multiple type yet
             }
             if (!isset($typeConversion[$type]) || empty($typeConversion[$type])) {
                 continue;
             }
             $this->atomIs('Functioncall')->analyzerIs('Functions/IsExtFunction')->fullnspathIs($functions)->outIs('ARGUMENTS')->outIs('ARGUMENT')->is('rank', $position)->isLiteral()->atomIsNot($typeConversion[$type])->back('first');
             $this->prepareQuery();
         }
     }
 }