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


PHP ReflectionMethod::isInternal方法代码示例

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


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

示例1: isInternal

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

示例2: generateMethodArguments

 /**
  * @param ReflectionMethod $method
  * @return string
  */
 function generateMethodArguments(ReflectionMethod $method)
 {
     if ($method->isInternal()) {
         // This code can`t handle constants, it replaces its with value
         return implode(', ', array_map(array($this, 'generateMethodArgument'), $method->getParameters()));
     } else {
         $lines = $this->getFileLines($method->getFileName());
         $start_line = $method->getStartLine() - 1;
         $function_lines = array_slice($lines, $start_line, $method->getEndLine() - $start_line);
         // todo: use code beautifier?
         return $this->parseFunctionArgs(implode(PHP_EOL, $function_lines));
     }
 }
开发者ID:Garcy111,项目名称:Garcy-Framework-2,代码行数:17,代码来源:ReflectionHelper.php

示例3: reflectMethod

function reflectMethod($class, $method)
{
    $methodInfo = new ReflectionMethod($class, $method);
    echo "**********************************\n";
    echo "Reflecting on method {$class}::{$method}()\n\n";
    echo "\ngetName():\n";
    var_dump($methodInfo->getName());
    echo "\nisInternal():\n";
    var_dump($methodInfo->isInternal());
    echo "\nisUserDefined():\n";
    var_dump($methodInfo->isUserDefined());
    echo "\n**********************************\n";
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:ReflectionMethod_basic3.php

示例4: handle

 /**
  * Handles request
  *
  * @return void
  */
 public function handle()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         die('JSON-RPC Server');
     }
     try {
         $request = json_decode(file_get_contents('php://input'));
         $reflection = new ReflectionMethod($this->_object, $request->method);
         if ($reflection->getNumberOfRequiredParameters() > count($request->params)) {
             throw new Exception("Params count doesn't match method signature.");
         }
         if (!$reflection->isPublic() || $reflection->isInternal()) {
             throw new Exception("Method is not callable");
         }
         $result = call_user_func_array(array($this->_object, $request->method), $request->params);
         $response = array('id' => $request->id, 'result' => $result, 'error' => null);
     } catch (Exception $e) {
         $response = array('id' => $request->id, 'result' => null, 'error' => $e->getMessage());
     }
     header('content-type: text/javascript');
     echo json_encode($response);
 }
开发者ID:raymondjavaxx,项目名称:php5-jsonrpc,代码行数:27,代码来源:Server.php

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

示例6: increment

<pre>
<?php 
class Counter
{
    private static $c = 0;
    public static final function increment()
    {
        return ++self::$c;
    }
}
// Создание экземпляра класса ReflectionMethod
$method = new ReflectionMethod('Counter', 'increment');
// exit;
// Вывод основной информации
printf("===> %s%s%s%s%s%s%s метод '%s' (который является %s)\n" . "     объявлен в %s\n" . "     строки с %d по %d\n" . "     имеет модификаторы %d[%s]\n", $method->isInternal() ? 'Встроенный' : 'Пользовательский', $method->isAbstract() ? ' абстрактный' : '', $method->isFinal() ? ' финальный' : '', $method->isPublic() ? ' public' : '', $method->isPrivate() ? ' private' : '', $method->isProtected() ? ' protected' : '', $method->isStatic() ? ' статический' : '', $method->getName(), $method->isConstructor() ? 'конструктором' : 'обычным методом', $method->getFileName(), $method->getStartLine(), $method->getEndline(), $method->getModifiers(), implode(' ', Reflection::getModifierNames($method->getModifiers())));
// Вывод статических переменных, если они есть
if ($statics = $method->getStaticVariables()) {
    printf("---> Статическая переменная: %s\n", var_export($statics, 1));
}
// Вызов метода
printf("---> Результат вызова: ");
$result = $method->invoke(3);
echo $result;
?>
</pre>
开发者ID:sydorenkovd,项目名称:features_for_phpoopsecond.local,代码行数:25,代码来源:03-method.php

示例7: increment

class Counter
{
    private static $c = 0;
    /**
     * Increment counter
     *
     * @final
     * @static
     * @access  public
     * @return  int
     */
    public static final function increment()
    {
        return ++self::$c;
    }
}
// Create an instance of the ReflectionMethod class
$method = new ReflectionMethod('Counter', 'increment');
// Print out basic information
printf("===> The %s%s%s%s%s%s%s method '%s' (which is %s)\n" . "     declared in %s\n" . "     lines %d to %d\n" . "     having the modifiers %d[%s]\n", $method->isInternal() ? 'internal' : 'user-defined', $method->isAbstract() ? ' abstract' : '', $method->isFinal() ? ' final' : '', $method->isPublic() ? ' public' : '', $method->isPrivate() ? ' private' : '', $method->isProtected() ? ' protected' : '', $method->isStatic() ? ' static' : '', $method->getName(), $method->isConstructor() ? 'the constructor' : 'a regular method', $method->getFileName(), $method->getStartLine(), $method->getEndline(), $method->getModifiers(), implode(' ', Reflection::getModifierNames($method->getModifiers())));
echo "\n";
// Print documentation comment
printf("---> Documentation:\n %s\n", var_export($method->getDocComment(), 1));
// Print static variables if existant
if ($statics = $method->getStaticVariables()) {
    printf("---> Static variables: %s\n", var_export($statics, 1));
}
echo "\n";
// Invoke the method
printf("---> Invocation results in: ");
var_dump($method->invoke(NULL));
开发者ID:jinguanio,项目名称:david,代码行数:31,代码来源:reflect_inner_closure.php

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

示例9: transformMethod

 function transformMethod(ReflectionMethod $method)
 {
     $is_internal = $method->isInternal() ? 'internal' : 'user-defined';
     $is_abstract = $method->isAbstract() ? ' abstract' : '';
     $is_final = $method->isFinal() ? ' final' : '';
     $is_public = $method->isPublic() ? ' public' : '';
     $is_private = $method->isPrivate() ? ' private' : '';
     $is_protected = $method->isProtected() ? ' protected' : '';
     $is_static = $method->isStatic() ? ' static' : '';
     $name = $method->getName();
     $class = $method->getDeclaringClass()->name;
     $is_constructor = $method->isConstructor() ? 'the constructor' : 'a regular method';
     $modifiers = Reflection::getModifierNames($method->getModifiers());
     extract($this->transformDocBlock($method->getDocComment()));
     $parameters = array();
     $parameters_concat = "";
     $_optional_count = 0;
     foreach ($method->getParameters() as $_param) {
         $parameters[$_param->getName()] = $this->transformParameter($_param, @$param[$_param->getName()]);
         if ($_param->isOptional()) {
             $parameters_concat .= " [ ";
             $_optional_count++;
         }
         if ($parameters_concat != "" && $parameters_concat != " [ ") {
             $parameters_concat .= ", ";
         }
         $parameters_concat .= $parameters[$_param->getName()];
     }
     $parameters_concat .= str_repeat(" ] ", $_optional_count);
     ob_start();
     include "templates/" . $this->template . "/method.tmpl.php";
     return ob_get_clean();
 }
开发者ID:harrysame,项目名称:PHP-MySQL,代码行数:33,代码来源:pepper.php


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