当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionMethod::isFinal方法代码示例

本文整理汇总了PHP中ReflectionMethod::isFinal方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionMethod::isFinal方法的具体用法?PHP ReflectionMethod::isFinal怎么用?PHP ReflectionMethod::isFinal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionMethod的用法示例。


在下文中一共展示了ReflectionMethod::isFinal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the application
  */
 public function run()
 {
     // Determine the client-side path to root
     if (!empty($_SERVER['REQUEST_URI'])) {
         $this->rootPath = preg_replace('/(index\\.php)?(\\?.*)?$/', '', $_SERVER['REQUEST_URI']);
         if (!empty($_GET['q'])) {
             $this->rootPath = preg_replace('/' . preg_quote($_GET['q'], '/') . '$/', '', $this->rootPath);
         }
     }
     // Extract controller name, view name, action name and arguments from URL
     $controllerName = 'Index';
     if (!empty($_GET['q'])) {
         $this->args = explode('/', $_GET['q']);
         if ($this->args) {
             $controllerName = str_replace(' ', '/', ucwords(str_replace('_', ' ', str_replace('-', '', array_shift($this->args)))));
         }
         if ($action = $this->args ? array_shift($this->args) : '') {
             $this->action = str_replace('-', '', $action);
         }
     }
     if (!is_file('Swiftlet/Controllers/' . $controllerName . '.php')) {
         $controllerName = 'Error404';
     }
     $this->view = new View($this, strtolower($controllerName));
     // Instantiate the controller
     $controllerName = 'Swiftlet\\Controllers\\' . basename($controllerName);
     $this->controller = new $controllerName($this, $this->view);
     // Load plugins
     if ($handle = opendir('Swiftlet/Plugins')) {
         while (($file = readdir($handle)) !== FALSE) {
             if (is_file('Swiftlet/Plugins/' . $file) && preg_match('/^(.+)\\.php$/', $file, $match)) {
                 $pluginName = 'Swiftlet\\Plugins\\' . $match[1];
                 $this->plugins[$pluginName] = array();
                 foreach (get_class_methods($pluginName) as $methodName) {
                     $method = new \ReflectionMethod($pluginName, $methodName);
                     if ($method->isPublic() && !$method->isFinal() && !$method->isConstructor()) {
                         $this->plugins[$pluginName][] = $methodName;
                     }
                 }
             }
         }
         ksort($this->plugins);
         closedir($handle);
     }
     // Call the controller action
     $this->registerHook('actionBefore');
     if (method_exists($this->controller, $this->action)) {
         $method = new \ReflectionMethod($this->controller, $this->action);
         if ($method->isPublic() && !$method->isFinal() && !$method->isConstructor()) {
             $this->controller->{$this->action}();
         } else {
             $this->controller->notImplemented();
         }
     } else {
         $this->controller->notImplemented();
     }
     $this->registerHook('actionAfter');
     return array($this->view, $this->controller);
 }
开发者ID:niceboy120,项目名称:Swiftlet,代码行数:62,代码来源:App.php

示例2: isFinal

 /**
  * Returns whether this method is final
  *
  * @return boolean TRUE if this method is final
  */
 public function isFinal()
 {
     if ($this->reflectionSource instanceof ReflectionMethod) {
         return $this->reflectionSource->isFinal();
     } else {
         return parent::isFinal();
     }
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:13,代码来源:method.php

示例3: _isSuitableMethod

 /**
  * Determines if the method is suitable to be used by the processor.
  * (see \Magento\Framework\Reflection\MethodsMap::isSuitableMethod)
  *
  * @param \ReflectionMethod $method
  * @return bool
  */
 public function _isSuitableMethod(\ReflectionMethod $method)
 {
     /* '&&' usage is shorter then '||', if first part is 'false' then all equity is false */
     $isSuitableMethodType = !$method->isStatic() && !$method->isFinal() && !$method->isConstructor() && !$method->isDestructor();
     $isExcludedMagicMethod = strpos($method->getName(), '__') === 0;
     $result = $isSuitableMethodType && !$isExcludedMagicMethod;
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:15,代码来源:Type.php

示例4: generateMethodCode

 private function generateMethodCode(\ReflectionMethod $method)
 {
     $name = $method->getName();
     if ($method->isStatic() || $method->isFinal() || $name == '__construct') {
         return '';
     }
     $params = array();
     foreach ($method->getParameters() as $parameter) {
         $params[] = $this->getParameterInfo($parameter);
     }
     return SurrogateMethodGenerator::generateDelegators($name, $params);
 }
开发者ID:marcellorvalle,项目名称:php-sandbox,代码行数:12,代码来源:SurrogateGenerator.php

示例5: fromReflection

 public static function fromReflection(\ReflectionMethod $ref)
 {
     $method = new static($ref->name);
     $method->setFinal($ref->isFinal())->setAbstract($ref->isAbstract())->setStatic($ref->isStatic())->setVisibility($ref->isPublic() ? self::VISIBILITY_PUBLIC : ($ref->isProtected() ? self::VISIBILITY_PROTECTED : self::VISIBILITY_PRIVATE))->setReferenceReturned($ref->returnsReference())->setBody(ReflectionUtils::getFunctionBody($ref));
     $docblock = new Docblock($ref);
     $method->setDocblock($docblock);
     $method->setDescription($docblock->getShortDescription());
     $method->setLongDescription($docblock->getLongDescription());
     foreach ($ref->getParameters() as $param) {
         $method->addParameter(static::createParameter($param));
     }
     return $method;
 }
开发者ID:jmcclell,项目名称:php-code-generator,代码行数:13,代码来源:PhpMethod.php

示例6: fromReflection

 public static function fromReflection(\ReflectionMethod $ref)
 {
     $method = new static();
     $method->setFinal($ref->isFinal())->setAbstract($ref->isAbstract())->setStatic($ref->isStatic())->setVisibility($ref->isPublic() ? self::VISIBILITY_PUBLIC : ($ref->isProtected() ? self::VISIBILITY_PROTECTED : self::VISIBILITY_PRIVATE))->setReferenceReturned($ref->returnsReference())->setName($ref->name);
     if ($docComment = $ref->getDocComment()) {
         $method->setDocblock(ReflectionUtils::getUnindentedDocComment($docComment));
     }
     foreach ($ref->getParameters() as $param) {
         $method->addParameter(static::createParameter($param));
     }
     // FIXME: Extract body?
     return $method;
 }
开发者ID:ingeniorweb,项目名称:symfo3cv,代码行数:13,代码来源:PhpMethod.php

示例7: method

 /**
  * @param \ReflectionMethod $method
  * @return \Phpy\Method\Method
  */
 public function method(\ReflectionMethod $method)
 {
     $phpyMethod = new Method($method->getName());
     $phpyMethod->setStatic($method->isStatic())->setFinal($method->isFinal())->setAbstract($method->isAbstract());
     if ($method->isPublic()) {
         $phpyMethod->setVisibility('public');
     } elseif ($method->isProtected()) {
         $phpyMethod->setVisibility('protected');
     } else {
         $phpyMethod->setVisibility('private');
     }
     foreach ($method->getParameters() as $refParameter) {
         $phpyMethod->addParameter($this->parameter($refParameter));
     }
     return $phpyMethod;
 }
开发者ID:nicmart,项目名称:phpy,代码行数:20,代码来源:PhpyFactory.php

示例8: __construct

 /**
  * Initializes method prophecy.
  *
  * @param ObjectProphecy                        $objectProphecy
  * @param string                                $methodName
  * @param null|Argument\ArgumentsWildcard|array $arguments
  *
  * @throws \Prophecy\Exception\Doubler\MethodNotFoundException If method not found
  */
 public function __construct(ObjectProphecy $objectProphecy, $methodName, $arguments = null)
 {
     $double = $objectProphecy->reveal();
     if (!method_exists($double, $methodName)) {
         throw new MethodNotFoundException(sprintf('Method `%s::%s()` is not defined.', get_class($double), $methodName), get_class($double), $methodName, $arguments);
     }
     $this->objectProphecy = $objectProphecy;
     $this->methodName = $methodName;
     $reflectedMethod = new \ReflectionMethod($double, $methodName);
     if ($reflectedMethod->isFinal()) {
         throw new MethodProphecyException(sprintf("Can not add prophecy for a method `%s::%s()`\n" . "as it is a final method.", get_class($double), $methodName), $this);
     }
     if (null !== $arguments) {
         $this->withArguments($arguments);
     }
 }
开发者ID:eristoddle,项目名称:zen-notebook,代码行数:25,代码来源:MethodProphecy.php

示例9: __construct

 /**
  * Initializes method prophecy.
  *
  * @param ObjectProphecy                        $objectProphecy
  * @param string                                $methodName
  * @param null|Argument\ArgumentsWildcard|array $arguments
  *
  * @throws \Prophecy\Exception\Doubler\MethodNotFoundException If method not found
  */
 public function __construct(ObjectProphecy $objectProphecy, $methodName, $arguments = null)
 {
     $double = $objectProphecy->reveal();
     if (!method_exists($double, $methodName)) {
         throw new MethodNotFoundException(sprintf('Method `%s::%s()` is not defined.', get_class($double), $methodName), get_class($double), $methodName, $arguments);
     }
     $this->objectProphecy = $objectProphecy;
     $this->methodName = $methodName;
     $reflectedMethod = new \ReflectionMethod($double, $methodName);
     if ($reflectedMethod->isFinal()) {
         throw new MethodProphecyException(sprintf("Can not add prophecy for a method `%s::%s()`\n" . "as it is a final method.", get_class($double), $methodName), $this);
     }
     if (null !== $arguments) {
         $this->withArguments($arguments);
     }
     if (version_compare(PHP_VERSION, '7.0', '>=') && true === $reflectedMethod->hasReturnType()) {
         $type = (string) $reflectedMethod->getReturnType();
         $this->will(function () use($type) {
             switch ($type) {
                 case 'string':
                     return '';
                 case 'float':
                     return 0.0;
                 case 'int':
                     return 0;
                 case 'bool':
                     return false;
                 case 'array':
                     return array();
                 case 'callable':
                 case 'Closure':
                     return function () {
                     };
                 case 'Traversable':
                 case 'Generator':
                     // Remove eval() when minimum version >=5.5
                     /** @var callable $generator */
                     $generator = eval('return function () { yield; };');
                     return $generator();
                 default:
                     $prophet = new Prophet();
                     return $prophet->prophesize($type)->reveal();
             }
         });
     }
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:55,代码来源:MethodProphecy.php

示例10: reflectMethod

function reflectMethod($class, $method)
{
    $methodInfo = new ReflectionMethod($class, $method);
    echo "**********************************\n";
    echo "Reflecting on method {$class}::{$method}()\n\n";
    echo "\nisFinal():\n";
    var_dump($methodInfo->isFinal());
    echo "\nisAbstract():\n";
    var_dump($methodInfo->isAbstract());
    echo "\nisPublic():\n";
    var_dump($methodInfo->isPublic());
    echo "\nisPrivate():\n";
    var_dump($methodInfo->isPrivate());
    echo "\nisProtected():\n";
    var_dump($methodInfo->isProtected());
    echo "\nisStatic():\n";
    var_dump($methodInfo->isStatic());
    echo "\nisConstructor():\n";
    var_dump($methodInfo->isConstructor());
    echo "\nisDestructor():\n";
    var_dump($methodInfo->isDestructor());
    echo "\n**********************************\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:23,代码来源:ReflectionMethod_basic1.php

示例11: methodData

function methodData(ReflectionMethod $method)
{
    $details = "";
    $name = $method->getName();
    if ($method->isUserDefined()) {
        $details .= "{$name} is user defined\n";
    }
    if ($method->isInternal()) {
        $details .= "{$name} is built-in\n";
    }
    if ($method->isAbstract()) {
        $details .= "{$name} is abstract\n";
    }
    if ($method->isPublic()) {
        $details .= "{$name} is public\n";
    }
    if ($method->isProtected()) {
        $details .= "{$name} is protected\n";
    }
    if ($method->isPrivate()) {
        $details .= "{$name} is private\n";
    }
    if ($method->isStatic()) {
        $details .= "{$name} is static\n";
    }
    if ($method->isFinal()) {
        $details .= "{$name} is final\n";
    }
    if ($method->isConstructor()) {
        $details .= "{$name} is the constructor\n";
    }
    if ($method->returnsReference()) {
        $details .= "{$name} returns a reference (as opposed to a value)\n";
    }
    return $details;
}
开发者ID:jabouzi,项目名称:projet,代码行数:36,代码来源:listing5.28.php

示例12: canProxyMethod

 /**
  * Determine if the given method may be proxied.
  *
  * Since it is not possible to reflect a
  *  - constructor
  *  - final method
  *  - static method
  * those will cause this method to return false.
  * Also methods registered in the blacklist will cause this
  * method to return false.
  *
  * @param \ReflectionMethod $method Name of the method to be reflected.
  *
  * @return boolean True, if the given method may be reflected, else false.
  */
 protected static function canProxyMethod(\ReflectionMethod $method)
 {
     if ($method->isConstructor() || $method->isFinal() || $method->isStatic() || isset(self::$blacklistedMethodNames[$method->getName()])) {
         return false;
     } elseif ($method->isProtected()) {
         return true;
     }
     return false;
 }
开发者ID:lapistano,项目名称:proxy-object,代码行数:24,代码来源:Generator.php

示例13: canMockMethod

 /**
  * @param  ReflectionMethod $method
  * @return boolean
  */
 protected static function canMockMethod(ReflectionMethod $method)
 {
     if ($method->isConstructor() || $method->isFinal() || isset(self::$blacklistedMethodNames[$method->getName()])) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:DaveNascimento,项目名称:civicrm-packages,代码行数:11,代码来源:Generator.php

示例14: scan

 public function scan()
 {
     require_once $this->path;
     $ns = "";
     $_ns = "";
     $ns_bracket = false;
     $aliases = [];
     $tokens = new Tokenizer(FS::get($this->path));
     while ($tokens->valid()) {
         if ($tokens->is(T_NAMESPACE)) {
             $ns = "";
             $_ns = "";
             $tokens->next();
             if ($tokens->is(T_STRING)) {
                 $ns = $this->_parseName($tokens);
                 if ($tokens->is('{')) {
                     $tokens->skip();
                     $ns_bracket = true;
                 } else {
                     $tokens->skipIf(';');
                 }
                 $_ns = $ns . '\\';
             } elseif ($tokens->is('{')) {
                 $ns_bracket = true;
                 $tokens->next();
             }
         } elseif ($tokens->is(T_USE)) {
             do {
                 $tokens->next();
                 $name = $this->_parseName($tokens);
                 if ($tokens->is(T_AS)) {
                     $aliases[$tokens->next()->get(T_STRING)] = $name;
                     $tokens->next();
                 } else {
                     if (strpos($name, '\\') === false) {
                         $aliases[$name] = $name;
                     } else {
                         $aliases[ltrim('\\', strrchr($name, '\\'))] = $name;
                     }
                 }
             } while ($tokens->is(','));
             $tokens->need(';')->next();
         } elseif ($tokens->is(T_CONST)) {
             $name = $tokens->next()->get(T_STRING);
             $constant = new EntityConstant($_ns . $name);
             $constant->setValue(constant($_ns . $name));
             $constant->setLine($this->line($tokens->getLine()));
             $this->constants[$_ns . $name] = $constant;
             $tokens->forwardTo(';')->next();
         } elseif ($tokens->is(T_FUNCTION)) {
             $name = $tokens->next()->get(T_STRING);
             $function = new EntityFunction($_ns . $name);
             $function->setLine($this->line($tokens->getLine()));
             $function->setAliases($aliases);
             $this->parseCallable($function, new \ReflectionFunction($function->name));
             $function->setBody($tokens->forwardTo('{')->getScope());
             $tokens->next();
             $this->functions[$function->name] = $function;
         } elseif ($tokens->is(T_FINAL, T_ABSTRACT, T_INTERFACE, T_TRAIT, T_CLASS)) {
             $tokens->forwardTo(T_STRING);
             $name = $tokens->current();
             $class = new EntityClass($_ns . $name);
             $ref = new \ReflectionClass($class->name);
             $doc = $ref->getDocComment();
             //                if($name == "NamesInterface") {
             //                    drop($ref);
             //                }
             if ($ref->isInterface()) {
                 $class->addFlag(Flags::IS_INTERFACE);
             } elseif ($ref->isTrait()) {
                 $class->addFlag(Flags::IS_TRAIT);
             } else {
                 $class->addFlag(Flags::IS_CLASS);
             }
             if ($ref->isAbstract()) {
                 $class->addFlag(Flags::IS_ABSTRACT);
             } elseif ($ref->isFinal()) {
                 $class->addFlag(Flags::IS_FINAL);
             }
             if ($doc) {
                 $info = ToolKit::parseDoc($doc);
                 $class->setDescription($info['desc']);
                 $class->addOptions($info['options']);
             }
             $class->setAliases($aliases);
             $class->setLine($this->line($tokens->getLine()));
             $tokens->next();
             if ($tokens->is(T_EXTENDS)) {
                 // process 'extends' keyword
                 do {
                     $tokens->next();
                     $root = $tokens->is(T_NS_SEPARATOR);
                     $parent = $this->_parseName($tokens);
                     if ($root) {
                         // extends from root namespace
                         $class->setParent($parent, $class->isInterface());
                     } elseif (isset($aliases[$parent])) {
                         $class->setParent($aliases[$parent], $class->isInterface());
                     } else {
                         $class->setParent($_ns . $parent, $class->isInterface());
//.........这里部分代码省略.........
开发者ID:sergeyk-jomedia,项目名称:koda,代码行数:101,代码来源:EntityFile.php

示例15: canMockMethod

 /**
  * @param ReflectionMethod $method
  *
  * @return bool
  */
 private function canMockMethod(ReflectionMethod $method)
 {
     if ($method->isConstructor() || $method->isFinal() || $method->isPrivate() || $this->isMethodNameBlacklisted($method->getName())) {
         return false;
     }
     return true;
 }
开发者ID:ezrra,项目名称:PHP,代码行数:12,代码来源:Generator.php


注:本文中的ReflectionMethod::isFinal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。