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


PHP ReflectionMethod::isDestructor方法代码示例

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


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

示例1: _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

示例2: isDestructor

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

示例3: condition

 /**
  * @inheritdoc
  */
 public function condition(\ReflectionMethod $method)
 {
     if ($method->isPublic() && !($method->isAbstract() || $method->isConstructor() || $method->isDestructor())) {
         if ($this->isTest || strlen($method->name) > 4 && substr($method->name, 0, 4) === 'test') {
             return true;
         }
     }
     return false;
 }
开发者ID:komex,项目名称:unteist,代码行数:12,代码来源:MethodsFilter.php

示例4: run

 /**
  * Load and run a test.
  * 
  * @param string $name Name of test to run. This test should be located in {package}/tests
  * folder.
  * 
  * @return NULL
  */
 public function run($name)
 {
     // Ready the report.
     $report = new View_Component('test-result');
     $report->outcome = 'pass';
     $report->passes = 0;
     $report->fails = 0;
     $report->test_count = 0;
     $results = array();
     // Load test.
     $test = ucfirst(strtolower($name)) . '_Test';
     $report->test = $test;
     $reflector = new ReflectionClass($test);
     // Is it enabled?
     $constants = $reflector->getConstants();
     if ($constants['ENABLED'] === TRUE) {
         $report->status = 'Enabled';
         // Get the public methods, they are our tests.
         $public_methods = $reflector->getMethods(ReflectionMethod::IS_PUBLIC);
         $runnable = array();
         foreach ($public_methods as $public_method) {
             $method = new ReflectionMethod($test, $public_method->name);
             // Constructor and Destructor should be used for setup/teardown only.
             if (!$method->isConstructor() && !$method->isDestructor()) {
                 $runnable[] = $method;
             }
         }
         // Run each test.
         $report->test_count = count($runnable);
         foreach ($runnable as $run) {
             $result = new stdClass();
             $result->test = $run->name;
             // Expectations will trigger Exceptions on failure.
             try {
                 $run->invoke(new $test());
                 $result->outcome = 'pass';
                 $report->passes++;
             } catch (Exception $e) {
                 $report->fails++;
                 $report->outcome = 'fail';
                 $result->outcome = 'fail';
                 $result->error = $e->getMessage();
             }
             array_push($results, $result);
         }
     } else {
         $report->status = 'Disabled';
     }
     $report->results = $results;
     $report->display_content();
 }
开发者ID:negative11,项目名称:negative11-vanilla,代码行数:59,代码来源:test.php

示例5: JResponse

 public function JResponse() {
     $result = null;
     if ($this->doAuthenticate()) {
         $mn = filter_input(INPUT_GET,self::$methodName,FILTER_SANITIZE_STRING);
         if (($mn!=null) && ($mn!=false)) {                
             if (method_exists($this, $mn)) {
                 $rfm = new ReflectionMethod($this, $mn);
                 if (( $rfm->isPublic() ) && (!$rfm->isConstructor() ) && (!$rfm->isDestructor() )) {
                     $result = call_user_func(array($this, $mn));
                     $this->doResponse($result);
                 } else
                     $this->doError("Method is not callable");
             } else
                 $this->doError("Method dose not exist");
         } else
             $this->doError("Method must be specified");
     } else
         $this->doError("Unauthorized");
     
 }
开发者ID:haan78,项目名称:hukuk,代码行数:20,代码来源:jresponse.php

示例6: validateCall

 /**
  * This method prevents catchable fatal errors when calling the API with missing arguments
  * @param string $method
  * @param array $arguments
  */
 protected function validateCall($controller, $method, $arguments)
 {
     if (get_class($controller) == 'vB_Api_Null') {
         /* No such Class in the core controllers
            but it may be defined in an extension */
         return 0;
     }
     if (method_exists($controller, $method)) {
         $reflection = new ReflectionMethod($controller, $method);
     } else {
         /* No such Method in the core controller
            but it may be defined in an extension */
         return 0;
     }
     if ($reflection->isStatic()) {
         return 2;
     }
     if ($reflection->isConstructor()) {
         return 3;
     }
     if ($reflection->isDestructor()) {
         return 4;
     }
     $index = 0;
     foreach ($reflection->getParameters() as $param) {
         if (!isset($arguments[$index])) {
             if (!$param->allowsNull() and !$param->isDefaultValueAvailable()) {
                 // cannot omit parameter
                 throw new vB_Exception_Api('invalid_data');
             }
         } else {
             if ($param->isArray() and !is_array($arguments[$index])) {
                 // array type was expected
                 throw new vB_Exception_Api('invalid_data');
             }
         }
         $index++;
     }
     return 1;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:45,代码来源:wrapper.php

示例7: response

    public function response() {
        parent::response();
        $this->setError("", 0);

        $mn = $this->method;
        if (method_exists($this, $mn)) {
            $rfm = new ReflectionMethod($this, $mn);
            if (( $rfm->isPublic() ) && (!$rfm->isConstructor() ) && (!$rfm->isDestructor() ) 
                    && ( $mn != "response" ) && ( $mn != "isError" ) && ($mn != "setOperation")
                    && ( $mn != "getError" ) && ( $mn != "getErrorCode" )
                ) {
                $response = call_user_func(array($this, $mn));
                return $response;
            } else {
                $this->setError("Method Access Problem", 2002);
                return false;
            }
        } else {
            $this->setError("Method not found", 2001);            
            return false;
        }
    }
开发者ID:haan78,项目名称:hukuk,代码行数:22,代码来源:model_multi.php

示例8: 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

示例9: __construct

<?php

trait Test
{
    public function __construct()
    {
    }
    public function __destruct()
    {
    }
    public function func()
    {
    }
}
$rconstr = new ReflectionMethod('Test::__construct');
$rdestr = new ReflectionMethod('Test::__destruct');
$rfunc = new ReflectionMethod('Test::func');
var_dump($rconstr->isConstructor());
var_dump($rconstr->isDestructor());
var_dump($rdestr->isConstructor());
var_dump($rdestr->isDestructor());
var_dump($rfunc->isConstructor());
var_dump($rfunc->isDestructor());
开发者ID:badlamer,项目名称:hhvm,代码行数:23,代码来源:1998.php

示例10: createMethod

 /**
  * This will return a full proxy-method source.
  *
  * @param \ReflectionMethod $method The method to be proxied.
  *
  * @see Proxy::$methodTemplate
  *
  * @return string
  */
 protected function createMethod(\ReflectionMethod $method)
 {
     $visibility = '';
     $additional = '';
     $name = $method->getName();
     if ($method->isPublic()) {
         $visibility = ' public';
     } else {
         if ($method->isProtected()) {
             $visibility = ' protected';
         } else {
             if ($method->isPrivate()) {
                 // useless really. $visibility = ' private';
                 return '';
             }
         }
     }
     if ($method->isStatic()) {
         // useless really. $additional .= ' static ';
         return '';
     }
     //if ($method->isAbstract()) {
     // useless really. $$additional .= ' abstract ';
     //return '';
     //}
     if ($method->isConstructor()) {
         $name = '__construct';
     } else {
         if ($method->isDestructor()) {
             $name = '__destruct';
         }
     }
     $args = array();
     foreach ($method->getParameters() as $parameter) {
         $args[] = $this->createParameter($parameter);
     }
     $src = $this->methodTemplate;
     $src = str_replace('VISIBILITY', $visibility, $src);
     $src = str_replace('ADDITIONAL', $additional, $src);
     $src = str_replace('METHOD_NAME', $name, $src);
     $src = str_replace('METHOD_ARGS', implode(',', $args), $src);
     $src = str_replace('CLASS_NAME', $method->getDeclaringClass()->getName(), $src);
     return $src;
 }
开发者ID:im286er,项目名称:Ding,代码行数:53,代码来源:Proxy.php

示例11: f

} catch (TypeError $re) {
    echo "Ok - " . $re->getMessage() . PHP_EOL;
}
try {
    new ReflectionMethod('a', 'b', 'c');
} catch (TypeError $re) {
    echo "Ok - " . $re->getMessage() . PHP_EOL;
}
class C
{
    public function f()
    {
    }
}
$rm = new ReflectionMethod('C', 'f');
var_dump($rm->isFinal(1));
var_dump($rm->isAbstract(1));
var_dump($rm->isPrivate(1));
var_dump($rm->isProtected(1));
var_dump($rm->isPublic(1));
var_dump($rm->isStatic(1));
var_dump($rm->isConstructor(1));
var_dump($rm->isDestructor(1));
var_dump($rm->getModifiers(1));
var_dump($rm->isInternal(1));
var_dump($rm->isUserDefined(1));
var_dump($rm->getFileName(1));
var_dump($rm->getStartLine(1));
var_dump($rm->getEndLine(1));
var_dump($rm->getStaticVariables(1));
var_dump($rm->getName(1));
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_reflection_tests_ReflectionMethod_006.php

示例12: method


//.........这里部分代码省略.........
			if(is_string($options['include'])){
				$options['include'] = explode(',',$options['include']);
			}
			if(is_array($options['include'])){
				$includeKeys = array();
				foreach($options['include'] as $key=>$value){
					if(is_int($key)){
						$includeKeys[$value] = true;
					}else if(is_array($value)){
						$includeKeys[$key] = $value;
					}
				}
			}else{
				$includeKeys = false;
			}
		}else{
			$includeKeys = false;
		}
		// Sanitize option "exclude"
		if(!empty($options['exclude'])){
			if(is_string($options['exclude'])){
				$options['exclude'] = explode(',',$options['exclude']);
			}
			if(is_array($options['exclude'])){
				$excludeKeys = array();
				foreach($options['exclude'] as $key=>$value){
					if(is_int($key)){
						$excludeKeys[$value] = true;
					}else if(is_array($value)){
						$excludeKeys[$key] = $value;
					}
				}
			}else{
				$excludeKeys = false;
			}
		}else{
			$excludeKeys = false;
		}
		$keys = array(
			'name',
			'filename',
			'is_abstract',
			'is_constructor',
			'is_destructor',
			'is_final',
			'is_private',
			'is_protected',
			'is_public',
			'is_static',
			'comment',
			'summary',
			'attributes');
		foreach($keys as $key){
			$options['return_'.$key] = !($excludeKeys && !empty($excludeKeys[$key]) && !is_array($excludeKeys[$key]))&&!($includeKeys && empty($includeKeys[$key]));
		}
		// Prepare returned array
		$return = array();
		// Start reflection
		if($options['return_name']){
			$return['name'] = $reflection->getName();
		}
		if($options['return_filename']){
			$return['filename'] = $reflection->getFileName();
		}
		if($options['return_is_abstract']){
			$return['is_abstract'] = $reflection->isAbstract();
		}
		if($options['return_is_constructor']){
			$return['is_constructor'] = $reflection->isConstructor();
		}
		if($options['return_is_destructor']){
			$return['is_destructor'] = $reflection->isDestructor();
		}
		if($options['return_is_final']){
			$return['is_final'] = $reflection->isFinal();
		}
		if($options['return_is_private']){
			$return['is_private'] = $reflection->isPrivate();
		}
		if($options['return_is_protected']){
			$return['is_protected'] = $reflection->isProtected();
		}
		if($options['return_is_public']){
			$return['is_public'] = $reflection->isPublic();
		}
		if($options['return_is_static']){
			$return['is_static'] = $reflection->isStatic();
		}
		list($comment,$summary,$attributes) = self::comment($reflection);
		if($options['return_comment']){
			$return['comment'] = $comment;
		}
		if($options['return_summary']){
			$return['summary'] = $summary;
		}
		if($options['return_attributes']){
			$return['attributes'] = $attributes;
		}
		return $return;
	}
开发者ID:rintaun,项目名称:himawari,代码行数:101,代码来源:PurApi.php

示例13: isInterceptedMethod

 /**
  * Whether method is intercepted
  *
  * @param \ReflectionMethod $method
  * @return bool
  */
 protected function isInterceptedMethod(\ReflectionMethod $method)
 {
     return !($method->isConstructor() || $method->isFinal() || $method->isStatic() || $method->isDestructor()) && !in_array($method->getName(), ['__sleep', '__wakeup', '__clone']);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:Interceptor.php

示例14: wrapPhpClass

 /**
  * Given a user-defined PHP class or php object, map its methods onto a list of
  * PHP 'wrapper' functions that can be exposed as xmlrpc methods from an xmlrpc server
  * object and called from remote clients (as well as their corresponding signature info).
  *
  * @param string|object $className the name of the class whose methods are to be exposed as xmlrpc methods, or an object instance of that class
  * @param array $extraOptions see the docs for wrapPhpMethod for basic options, plus
  *                            - string method_type    'static', 'nonstatic', 'all' and 'auto' (default); the latter will switch between static and non-static depending on whether $className is a class name or object instance
  *                            - string method_filter  a regexp used to filter methods to wrap based on their names
  *                            - string prefix         used for the names of the xmlrpc methods created
  *
  * @return array|false false on failure
  */
 public function wrapPhpClass($className, $extraOptions = array())
 {
     $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
     $methodType = isset($extraOptions['method_type']) ? $extraOptions['method_type'] : 'auto';
     $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '';
     $results = array();
     $mList = get_class_methods($className);
     foreach ($mList as $mName) {
         if ($methodFilter == '' || preg_match($methodFilter, $mName)) {
             $func = new \ReflectionMethod($className, $mName);
             if (!$func->isPrivate() && !$func->isProtected() && !$func->isConstructor() && !$func->isDestructor() && !$func->isAbstract()) {
                 if ($func->isStatic() && ($methodType == 'all' || $methodType == 'static' || $methodType == 'auto' && is_string($className)) || !$func->isStatic() && ($methodType == 'all' || $methodType == 'nonstatic' || $methodType == 'auto' && is_object($className))) {
                     $methodWrap = $this->wrapPhpFunction(array($className, $mName), '', $extraOptions);
                     if ($methodWrap) {
                         if (is_object($className)) {
                             $realClassName = get_class($className);
                         } else {
                             $realClassName = $className;
                         }
                         $results[$prefix . "{$realClassName}.{$mName}"] = $methodWrap;
                     }
                 }
             }
         }
     }
     return $results;
 }
开发者ID:TsobuEnterprise,项目名称:phpxmlrpc,代码行数:40,代码来源:Wrapper.php

示例15: getRequests

    $right = strrpos($value, '.');
    $left = strlen($dir) + 1;
    $name = substr($value, $left, $right - $left);
    if (stristr($name, 'Service')) {
        $tokens = split('_', $name);
        $str = '';
        foreach ($tokens as $t => $token) {
            $str = $str . strtoupper(substr($token, 0, 1)) . substr($token, 1);
        }
        if ($str != '') {
            require_once $value;
            $instance = new $str();
            $methods = get_class_methods($instance);
            foreach ($methods as $m => $method) {
                $rm = new ReflectionMethod($str, $method);
                if ($rm->isUserDefined() && !$rm->isConstructor() && !$rm->isDestructor() && $rm->getNumberOfParameters() == 2) {
                    $comment = $rm->getDocComment();
                    $metadata = getServiceMetadata($comment);
                    if ($metadata === FALSE) {
                        // could not parse metadata
                        continue;
                    }
                    $request = $metadata['request'];
                    $adapter = new ServiceAdapter($instance, $rm, $metadata);
                    registerService($request, $adapter, $services);
                }
            }
        }
    }
}
function getRequests($content_type, $input)
开发者ID:apinstein,项目名称:phocoa,代码行数:31,代码来源:servicebroker_5.php


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