Exakat\Data\ZendF2::getClassByRelease PHP Method

getClassByRelease() public method

public getClassByRelease ( $release = null )
    public function getClassByRelease($release = null)
    {
        $query = 'SELECT namespaces.namespace || "\\" || class AS class, release FROM classes 
                    JOIN namespaces 
                      ON classes.namespace_id = namespaces.id
                    JOIN releases 
                      ON namespaces.release_id = releases.id';
        if ($release !== null) {
            $query .= " WHERE releases.release = \"release-{$release}.0\"";
        }
        $res = $this->sqlite->query($query);
        $return = array();
        while ($row = $res->fetchArray(SQLITE3_ASSOC)) {
            if (isset($return[$row['release']])) {
                $return[$row['release']][] = $row['class'];
            } else {
                $return[$row['release']] = array($row['class']);
            }
        }
        return $return;
    }

Usage Example

Example #1
0
 public function analyze()
 {
     if (in_array($this->release, array('1.5', '1.6', '1.7', '1.8', '1.9', '1.10', '1.11', '1.12'))) {
         $data = new ZendF();
     } elseif (in_array($this->release, array('2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '3.0'))) {
         $data = new ZendF2();
     } else {
         $this->release = '2.5';
         $data = new ZendF2();
     }
     $classes = $data->getClassByRelease($this->release);
     $classes = $this->makeFullNsPath(array_pop($classes));
     $interfaces = $data->getInterfaceByRelease($this->release);
     $interfaces = $this->makeFullNsPath(array_pop($interfaces));
     $traits = $data->getTraitByRelease($this->release);
     $traits = $this->makeFullNsPath(array_pop($traits));
     $all = array_merge($classes, $interfaces, $traits);
     $this->analyzerIs('ZendF/ZendClasses')->fullnspathIsNot($classes);
     $this->prepareQuery();
     $this->analyzerIs('ZendF/ZendTrait')->fullnspathIsNot($traits);
     $this->prepareQuery();
     $this->analyzerIs('ZendF/ZendInterfaces')->fullnspathIsNot($interfaces);
     $this->prepareQuery();
 }