Initial import.

This commit is contained in:
ekes 2015-02-24 16:25:12 +01:00
commit 86383280c9
428 changed files with 68738 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
/**
* Finds a class in a PSR-0 structure.
*
* @author Karoly Negyesi <karoly@negyesi.net>
*/
interface ClassFinderInterface
{
/**
* Finds a class.
*
* @param string $class The name of the class.
*
* @return
* The name of the class or NULL if not found.
*/
public function findFile($class);
}

View file

@ -0,0 +1,83 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
/**
* Finds a class in a PSR-0 structure.
*
* @author Karoly Negyesi <karoly@negyesi.net>
*/
class Psr0FindFile implements ClassFinderInterface
{
/**
* The PSR-0 prefixes.
*
* @var string
*/
protected $prefixes;
/**
* @param string $prefixes
* An array of prefixes. Each key is a PHP namespace and each value is
* a list of directories.
*/
public function __construct($prefixes)
{
$this->prefixes = $prefixes;
}
/**
* Finds a class.
*
* @param string $class The name of the class.
*
* @return
* The name of the class or NULL if not found.
*/
public function findFile($class)
{
$lastNsPos = strrpos($class, '\\');
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (false !== $lastNsPos) {
// namespaced class name
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $lastNsPos)) . DIRECTORY_SEPARATOR;
$className = substr($class, $lastNsPos + 1);
} else {
// PEAR-like class name
$classPath = null;
$className = $class;
}
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
}
}

View file

@ -0,0 +1,45 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
interface ReflectionProviderInterface
{
/**
* Get the ReflectionClass equivalent for this class.
*
* @return ReflectionClass
*/
public function getReflectionClass();
/**
* Get the ReflectionClass equivalent for this class.
*
* @return ReflectionMethod
*/
public function getReflectionMethod($name);
/**
* Get the ReflectionClass equivalent for this class.
*
* @return ReflectionMethod
*/
public function getReflectionProperty($name);
}

View file

@ -0,0 +1,112 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
use ReflectionClass;
use ReflectionException;
class StaticReflectionClass extends ReflectionClass
{
/**
* The static reflection parser object.
*
* @var StaticReflectionParser
*/
private $staticReflectionParser;
public function __construct(StaticReflectionParser $staticReflectionParser)
{
$this->staticReflectionParser = $staticReflectionParser;
}
public function getName()
{
return $this->staticReflectionParser->getClassName();
}
public function getDocComment()
{
return $this->staticReflectionParser->getDocComment();
}
public function getNamespaceName()
{
return $this->staticReflectionParser->getNamespaceName();
}
public function getUseStatements()
{
return $this->staticReflectionParser->getUseStatements();
}
public function getMethod($name)
{
return $this->staticReflectionParser->getReflectionMethod($name);
}
public function getProperty($name)
{
return $this->staticReflectionParser->getReflectionProperty($name);
}
public static function export($argument, $return = false) { throw new ReflectionException('Method not implemented'); }
public function getConstant($name) { throw new ReflectionException('Method not implemented'); }
public function getConstants() { throw new ReflectionException('Method not implemented'); }
public function getConstructor() { throw new ReflectionException('Method not implemented'); }
public function getDefaultProperties() { throw new ReflectionException('Method not implemented'); }
public function getEndLine() { throw new ReflectionException('Method not implemented'); }
public function getExtension() { throw new ReflectionException('Method not implemented'); }
public function getExtensionName() { throw new ReflectionException('Method not implemented'); }
public function getFileName() { throw new ReflectionException('Method not implemented'); }
public function getInterfaceNames() { throw new ReflectionException('Method not implemented'); }
public function getInterfaces() { throw new ReflectionException('Method not implemented'); }
public function getMethods($filter = NULL) { throw new ReflectionException('Method not implemented'); }
public function getModifiers() { throw new ReflectionException('Method not implemented'); }
public function getParentClass() { throw new ReflectionException('Method not implemented'); }
public function getProperties($filter = NULL) { throw new ReflectionException('Method not implemented'); }
public function getShortName() { throw new ReflectionException('Method not implemented'); }
public function getStartLine() { throw new ReflectionException('Method not implemented'); }
public function getStaticProperties() { throw new ReflectionException('Method not implemented'); }
public function getStaticPropertyValue($name, $default = '') { throw new ReflectionException('Method not implemented'); }
public function getTraitAliases() { throw new ReflectionException('Method not implemented'); }
public function getTraitNames() { throw new ReflectionException('Method not implemented'); }
public function getTraits() { throw new ReflectionException('Method not implemented'); }
public function hasConstant($name) { throw new ReflectionException('Method not implemented'); }
public function hasMethod($name) { throw new ReflectionException('Method not implemented'); }
public function hasProperty($name) { throw new ReflectionException('Method not implemented'); }
public function implementsInterface($interface) { throw new ReflectionException('Method not implemented'); }
public function inNamespace() { throw new ReflectionException('Method not implemented'); }
public function isAbstract() { throw new ReflectionException('Method not implemented'); }
public function isCloneable() { throw new ReflectionException('Method not implemented'); }
public function isFinal() { throw new ReflectionException('Method not implemented'); }
public function isInstance($object) { throw new ReflectionException('Method not implemented'); }
public function isInstantiable() { throw new ReflectionException('Method not implemented'); }
public function isInterface() { throw new ReflectionException('Method not implemented'); }
public function isInternal() { throw new ReflectionException('Method not implemented'); }
public function isIterateable() { throw new ReflectionException('Method not implemented'); }
public function isSubclassOf($class) { throw new ReflectionException('Method not implemented'); }
public function isTrait() { throw new ReflectionException('Method not implemented'); }
public function isUserDefined() { throw new ReflectionException('Method not implemented'); }
public function newInstance($args) { throw new ReflectionException('Method not implemented'); }
public function newInstanceArgs(array $args = array()) { throw new ReflectionException('Method not implemented'); }
public function newInstanceWithoutConstructor() { throw new ReflectionException('Method not implemented'); }
public function setStaticPropertyValue($name, $value) { throw new ReflectionException('Method not implemented'); }
public function __toString() { throw new ReflectionException('Method not implemented'); }
}

View file

@ -0,0 +1,103 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
use ReflectionMethod;
use ReflectionException;
class StaticReflectionMethod extends ReflectionMethod
{
/**
* The PSR-0 parser object.
*
* @var StaticReflectionParser
*/
protected $staticReflectionParser;
/**
* The name of the method.
*
* @var string
*/
protected $methodName;
public function __construct(StaticReflectionParser $staticReflectionParser, $methodName)
{
$this->staticReflectionParser = $staticReflectionParser;
$this->methodName = $methodName;
}
public function getName()
{
return $this->methodName;
}
protected function getStaticReflectionParser()
{
return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('method', $this->methodName);
}
public function getDeclaringClass()
{
return $this->getStaticReflectionParser()->getReflectionClass();
}
public function getNamespaceName()
{
return $this->getStaticReflectionParser()->getNamespaceName();
}
public function getDocComment()
{
return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName);
}
public function getUseStatements()
{
return $this->getStaticReflectionParser()->getUseStatements();
}
public static function export($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); }
public function getClosure($object) { throw new ReflectionException('Method not implemented'); }
public function getModifiers() { throw new ReflectionException('Method not implemented'); }
public function getPrototype() { throw new ReflectionException('Method not implemented'); }
public function invoke($object, $parameter = NULL) { throw new ReflectionException('Method not implemented'); }
public function invokeArgs($object, array $args) { throw new ReflectionException('Method not implemented'); }
public function isAbstract() { throw new ReflectionException('Method not implemented'); }
public function isConstructor() { throw new ReflectionException('Method not implemented'); }
public function isDestructor() { throw new ReflectionException('Method not implemented'); }
public function isFinal() { throw new ReflectionException('Method not implemented'); }
public function isPrivate() { throw new ReflectionException('Method not implemented'); }
public function isProtected() { throw new ReflectionException('Method not implemented'); }
public function isPublic() { throw new ReflectionException('Method not implemented'); }
public function isStatic() { throw new ReflectionException('Method not implemented'); }
public function setAccessible($accessible) { throw new ReflectionException('Method not implemented'); }
public function __toString() { throw new ReflectionException('Method not implemented'); }
public function getClosureThis() { throw new ReflectionException('Method not implemented'); }
public function getEndLine() { throw new ReflectionException('Method not implemented'); }
public function getExtension() { throw new ReflectionException('Method not implemented'); }
public function getExtensionName() { throw new ReflectionException('Method not implemented'); }
public function getFileName() { throw new ReflectionException('Method not implemented'); }
public function getNumberOfParameters() { throw new ReflectionException('Method not implemented'); }
public function getNumberOfRequiredParameters() { throw new ReflectionException('Method not implemented'); }
public function getParameters() { throw new ReflectionException('Method not implemented'); }
public function getShortName() { throw new ReflectionException('Method not implemented'); }
public function getStartLine() { throw new ReflectionException('Method not implemented'); }
public function getStaticVariables() { throw new ReflectionException('Method not implemented'); }
public function inNamespace() { throw new ReflectionException('Method not implemented'); }
public function isClosure() { throw new ReflectionException('Method not implemented'); }
public function isDeprecated() { throw new ReflectionException('Method not implemented'); }
public function isInternal() { throw new ReflectionException('Method not implemented'); }
public function isUserDefined() { throw new ReflectionException('Method not implemented'); }
public function returnsReference() { throw new ReflectionException('Method not implemented'); }
}

View file

@ -0,0 +1,282 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
use ReflectionException;
use Doctrine\Common\Annotations\TokenParser;
/**
* Parses a file for namespaces/use/class declarations.
*
* @author Karoly Negyesi <karoly@negyesi.net>
*/
class StaticReflectionParser implements ReflectionProviderInterface
{
/**
* The name of the class.
*
* @var string
*/
protected $className;
/**
* TRUE if the caller only wants class annotations.
*
* @var boolean.
*/
protected $classAnnotationOptimize;
/**
* TRUE when the parser has ran.
*
* @var boolean
*/
protected $parsed = false;
/**
* The namespace of the class
*
* @var string
*/
protected $namespace = '';
/**
* The use statements of this class.
*
* @var array
*/
protected $useStatements = array();
/**
* The docComment of the class.
*
* @var string
*/
protected $docComment = array(
'class' => '',
'property' => array(),
'method' => array(),
);
/**
* The name of the class this class extends, if any.
*
* @var string
*/
protected $parentClassName = '';
/**
* The parent PSR-0 Parser.
*
* @var \Doctrine\Common\Annotations\StaticReflectionParser
*/
protected $parentStaticReflectionParser;
/**
* Parses a class residing in a PSR-0 hierarchy.
*
* @param string $class
* The full, namespaced class name.
* @param ClassFinder $finder
* A ClassFinder object which finds the class.
* @param boolean $classAnnotationOptimize
* Only retrieve the class docComment. Presumes there is only one
* statement per line.
*/
public function __construct($className, $finder, $classAnnotationOptimize = false)
{
$this->className = ltrim($className, '\\');
if ($lastNsPos = strrpos($this->className, '\\')) {
$this->namespace = substr($this->className, 0, $lastNsPos);
}
$this->finder = $finder;
$this->classAnnotationOptimize = $classAnnotationOptimize;
}
protected function parse()
{
if ($this->parsed || !$fileName = $this->finder->findFile($this->className)) {
return;
}
$this->parsed = true;
$contents = file_get_contents($fileName);
if ($this->classAnnotationOptimize) {
if (preg_match("/(\A.*)^\s+(abstract|final)?\s+class\s+$className\s+{/sm", $contents, $matches)) {
$contents = $matches[1];
}
}
$tokenParser = new TokenParser($contents);
$docComment = '';
while ($token = $tokenParser->next(false)) {
if (is_array($token)) {
switch ($token[0]) {
case T_USE:
$this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement());
break;
case T_DOC_COMMENT:
$docComment = $token[1];
break;
case T_CLASS:
$this->docComment['class'] = $docComment;
$docComment = '';
break;
case T_VAR:
case T_PRIVATE:
case T_PROTECTED:
case T_PUBLIC:
$token = $tokenParser->next();
if ($token[0] === T_VARIABLE) {
$propertyName = substr($token[1], 1);
$this->docComment['property'][$propertyName] = $docComment;
continue 2;
}
if ($token[0] !== T_FUNCTION) {
// For example, it can be T_FINAL.
continue 2;
}
// No break.
case T_FUNCTION:
// The next string after function is the name, but
// there can be & before the function name so find the
// string.
while (($token = $tokenParser->next()) && $token[0] !== T_STRING);
$methodName = $token[1];
$this->docComment['method'][$methodName] = $docComment;
$docComment = '';
break;
case T_EXTENDS:
$this->parentClassName = $tokenParser->parseClass();
$nsPos = strpos($this->parentClassName, '\\');
$fullySpecified = false;
if ($nsPos === 0) {
$fullySpecified = true;
} else {
if ($nsPos) {
$prefix = strtolower(substr($this->parentClassName, 0, $nsPos));
$postfix = substr($this->parentClassName, $nsPos);
} else {
$prefix = strtolower($this->parentClassName);
$postfix = '';
}
foreach ($this->useStatements as $alias => $use) {
if ($alias == $prefix) {
$this->parentClassName = '\\' . $use . $postfix;
$fullySpecified = true;
}
}
}
if (!$fullySpecified) {
$this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
}
break;
}
}
}
}
protected function getParentStaticReflectionParser()
{
if (empty($this->parentStaticReflectionParser)) {
$this->parentStaticReflectionParser = new static($this->parentClassName, $this->finder);
}
return $this->parentStaticReflectionParser;
}
public function getClassName()
{
return $this->className;
}
public function getNamespaceName()
{
return $this->namespace;
}
/**
* Get the ReflectionClass equivalent for this file / class.
*/
public function getReflectionClass()
{
return new StaticReflectionClass($this);
}
/**
* Get the ReflectionMethod equivalent for the method of this file / class.
*/
public function getReflectionMethod($methodName)
{
return new StaticReflectionMethod($this, $methodName);
}
/**
* Get the ReflectionProperty equivalent for the method of this file / class.
*/
public function getReflectionProperty($propertyName)
{
return new StaticReflectionProperty($this, $propertyName);
}
/**
* Get the use statements from this file.
*/
public function getUseStatements()
{
$this->parse();
return $this->useStatements;
}
/**
* Get docComment.
*
* @param string $type class, property or method.
* @param string $name Name of the property or method, not needed for class.
*
* @return string the doc comment or empty string if none.
*/
public function getDocComment($type = 'class', $name = '')
{
$this->parse();
return $name ? $this->docComment[$type][$name] : $this->docComment[$type];
}
/**
* Get the PSR-0 parser for the declaring class.
*
* @param string $type property or method.
* @param string $name Name of the property or method.
*
* @return StaticReflectionParser A static reflection parser for the declaring class.
*/
public function getStaticReflectionParserForDeclaringClass($type, $name)
{
$this->parse();
if (isset($this->docComment[$type][$name])) {
return $this;
}
if (!empty($this->parentClassName)) {
return $this->getParentStaticReflectionParser()->getStaticReflectionParserForDeclaringClass($type, $name);
}
throw new ReflectionException('Invalid ' . $type . ' "' . $name . '"');
}
}

View file

@ -0,0 +1,77 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Common\Reflection;
use ReflectionProperty;
use ReflectionException;
class StaticReflectionProperty extends ReflectionProperty
{
/**
* The PSR-0 parser object.
*
* @var StaticReflectionParser
*/
protected $staticReflectionParser;
/**
* The name of the property.
*
* @var string
*/
protected $propertyName;
public function __construct(StaticReflectionParser $staticReflectionParser, $propertyName)
{
$this->staticReflectionParser = $staticReflectionParser;
$this->propertyName = $propertyName;
}
public function getName()
{
return $this->propertyName;
}
protected function getStaticReflectionParser()
{
return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', $this->propertyName);
}
public function getDeclaringClass()
{
return $this->getStaticReflectionParser()->getReflectionClass();
}
public function getDocComment()
{
return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName);
}
public function getUseStatements()
{
return $this->getStaticReflectionParser()->getUseStatements();
}
public static function export ($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); }
public function getModifiers() { throw new ReflectionException('Method not implemented'); }
public function getValue($object = NULL) { throw new ReflectionException('Method not implemented'); }
public function isDefault() { throw new ReflectionException('Method not implemented'); }
public function isPrivate() { throw new ReflectionException('Method not implemented'); }
public function isProtected() { throw new ReflectionException('Method not implemented'); }
public function isPublic() { throw new ReflectionException('Method not implemented'); }
public function isStatic() { throw new ReflectionException('Method not implemented'); }
public function setAccessible ($accessible) { throw new ReflectionException('Method not implemented'); }
public function setValue ($object, $value = NULL) { throw new ReflectionException('Method not implemented'); }
public function __toString() { throw new ReflectionException('Method not implemented'); }
}