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


PHP ReflectionMethod::isConstructor方法代码示例

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


在下文中一共展示了ReflectionMethod::isConstructor方法的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: isConstructor

 /**
  * Returns whether this method is a constructor
  *
  * @return boolean TRUE if this method is a constructor
  */
 public function isConstructor()
 {
     if ($this->reflectionSource instanceof ReflectionMethod) {
         return $this->reflectionSource->isConstructor();
     } else {
         return parent::isConstructor();
     }
 }
开发者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: _actionExists

 private function _actionExists($action)
 {
     try {
         $method = new ReflectionMethod(get_class($this), $action);
         return $method->isPublic() && !$method->isConstructor();
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:rjoganah,项目名称:Healthcare_social_network,代码行数:9,代码来源:ActionController.php

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

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

示例7: execute

 /**
  * Realiza el dispatch de una ruta
  *
  * @return Object
  */
 public static function execute($route)
 {
     extract($route, EXTR_OVERWRITE);
     if (!(include_once APP_PATH . "controllers/{$controller_path}" . '_controller.php')) {
         throw new KumbiaException(NULL, 'no_controller');
     }
     //Asigna el controlador activo
     $app_controller = Util::camelcase($controller) . 'Controller';
     $cont = self::$_controller = new $app_controller($module, $controller, $action, $parameters);
     View::select($action);
     View::setPath($controller_path);
     // Se ejecutan los filtros before
     if ($cont->k_callback('initialize') === FALSE) {
         return $cont;
     }
     if ($cont->k_callback('before_filter') === FALSE) {
         return $cont;
     }
     //Se ejecuta el metodo con el nombre de la accion
     //en la clase de acuerdo al convenio
     if (!method_exists($cont, $action)) {
         throw new KumbiaException(NULL, 'no_action');
     }
     //Obteniendo el metodo
     $reflectionMethod = new ReflectionMethod($cont, $action);
     //k_callback y __constructor metodo reservado
     if ($reflectionMethod->name == 'k_callback' || $reflectionMethod->isConstructor()) {
         throw new KumbiaException('Esta intentando ejecutar un método reservado de KumbiaPHP');
     }
     //se verifica que el metodo sea public
     if (!$reflectionMethod->isPublic()) {
         throw new KumbiaException(NULL, 'no_action');
     }
     //se verifica que los parametros que recibe
     //la action sea la cantidad correcta
     $num_params = count($parameters);
     if ($cont->limit_params && ($num_params < $reflectionMethod->getNumberOfRequiredParameters() || $num_params > $reflectionMethod->getNumberOfParameters())) {
         throw new KumbiaException("Número de parámetros erroneo para ejecutar la acción \"{$action}\" en el controlador \"{$controller}\"");
     }
     $reflectionMethod->invokeArgs($cont, $parameters);
     //Corre los filtros after
     $cont->k_callback('after_filter');
     $cont->k_callback('finalize');
     //Si esta routed volver a ejecutar
     if (Router::getRouted()) {
         Router::setRouted(FALSE);
         return Dispatcher::execute(Router::get());
         // Vuelve a ejecutar el dispatcher
     }
     return $cont;
 }
开发者ID:albertmolina,项目名称:Daily-Content-Manager,代码行数:56,代码来源:dispatcher.php

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

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

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

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

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

示例13: isSuitableMethod

 /**
  * Determines if the method is suitable to be used by the processor.
  *
  * @param \ReflectionMethod $method
  * @return bool
  */
 private function isSuitableMethod($method)
 {
     $isSuitableMethodType = !($method->isConstructor() || $method->isFinal() || $method->isStatic() || $method->isDestructor());
     $isExcludedMagicMethod = strpos($method->getName(), '__') === 0;
     return $isSuitableMethodType && !$isExcludedMagicMethod;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:12,代码来源:MethodsMap.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: ucfirst

$class = ucfirst($RTR->class);
$method = $RTR->method;
if (empty($class) or !file_exists(APPPATH . 'controllers/' . $RTR->directory . $class . '.php')) {
    $e404 = TRUE;
} else {
    require_once APPPATH . 'controllers/' . $RTR->directory . $class . '.php';
    if (!class_exists($class, FALSE) or $method[0] === '_' or method_exists('CI_Controller', $method)) {
        $e404 = TRUE;
    } elseif (method_exists($class, '_remap')) {
        $params = array($method, array_slice($URI->rsegments, 2));
        $method = '_remap';
    } elseif (!method_exists($class, $method)) {
        $e404 = TRUE;
    } elseif (!is_callable(array($class, $method)) && strcasecmp($class, $method) === 0) {
        $reflection = new ReflectionMethod($class, $method);
        if (!$reflection->isPublic() or $reflection->isConstructor()) {
            $e404 = TRUE;
        }
    }
}
if ($e404) {
    if (!empty($RTR->routes['404_override'])) {
        if (sscanf($RTR->routes['404_override'], '%[^/]/%s', $error_class, $error_method) !== 2) {
            $error_method = 'index';
        }
        $error_class = ucfirst($error_class);
        if (!class_exists($error_class, FALSE)) {
            if (file_exists(APPPATH . 'controllers/' . $RTR->directory . $error_class . '.php')) {
                require_once APPPATH . 'controllers/' . $RTR->directory . $error_class . '.php';
                $e404 = !class_exists($error_class, FALSE);
            } elseif (!empty($RTR->directory) && file_exists(APPPATH . 'controllers/' . $error_class . '.php')) {
开发者ID:assad2012,项目名称:My_CodeIgniter,代码行数:31,代码来源:CodeIgniter.php


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