gossi\codegen\model\AbstractPhpStruct::getUseStatements PHP Method

getUseStatements() public method

Returns all use statements
public getUseStatements ( ) : phootwork\collection\Map
return phootwork\collection\Map collection of use statements
    public function getUseStatements()
    {
        return $this->useStatements;
    }

Usage Example

 protected function visitUseStatements(AbstractPhpStruct $struct)
 {
     if ($useStatements = $struct->getUseStatements()) {
         $this->ensureBlankLine();
         foreach ($useStatements as $alias => $namespace) {
             if (false === strpos($namespace, '\\')) {
                 $commonName = $namespace;
             } else {
                 $commonName = substr($namespace, strrpos($namespace, '\\') + 1);
             }
             if (false === strpos($namespace, '\\') && !$struct->getNamespace()) {
                 //avoid fatal 'The use statement with non-compound name '$commonName' has no effect'
                 continue;
             }
             $this->writer->write('use ' . $namespace);
             if ($commonName !== $alias) {
                 $this->writer->write(' as ' . $alias);
             }
             $this->writer->write(";\n");
         }
         $this->ensureBlankLine();
     }
 }
All Usage Examples Of gossi\codegen\model\AbstractPhpStruct::getUseStatements