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


PHP Method类代码示例

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


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

示例1: parse

 public function parse($comment)
 {
     $lines = $this->getLines($comment);
     $lines = array_map(function ($line) {
         return $this->parseLine($line);
     }, $lines);
     $lines = array_filter($lines, function ($line) {
         return $line && $this->isParam($line) && $this->hasExtra($line);
     });
     $lines = array_map(function ($line) {
         return array_slice($line, 1);
     }, $lines);
     if (count($lines) > 0) {
         $method = new Method();
         $index = 0;
         foreach ($lines as $line) {
             if (count($line) == 1) {
                 // @param {type}
                 $method->addParam($index++, $line[0]);
             } else {
                 if (count($line) >= 2) {
                     // @param {type} ${name} [...]
                     $method->addParam($index++, $line[0], ltrim($line[1], '$'));
                 }
             }
         }
         return $method;
     }
     return false;
 }
开发者ID:rmasters,项目名称:reflection-casting,代码行数:30,代码来源:MethodParser.php

示例2: Method

 public function &updateClassDetails(&$File, &$Component, &$SourceAnalyzer)
 {
     $MethodInstance = new Method(array('init' => false));
     $MethodInstance->setConnection($this->getConnection());
     $MethodInstance->init();
     $parsed_details = $SourceAnalyzer->getParsedArray($File->body);
     $available_classes = empty($parsed_details['classes']) ? array() : array_keys($parsed_details['classes']);
     if (empty($available_classes)) {
         return $available_classes;
     }
     $Classes = array();
     foreach ($available_classes as $class_name) {
         $extends = !empty($parsed_details['classes'][$class_name]['extends']) ? $parsed_details['classes'][$class_name]['extends'] : false;
         if ($extends) {
             $SourceAnalyzer->log('Looking for parent class: ' . $extends);
             $ParentClass = $this->_addOrUpdateClassDetails($extends, $File, $Component, $SourceAnalyzer, array(), true);
         }
         $Class = $this->_addOrUpdateClassDetails($class_name, $File, $Component, $SourceAnalyzer, $parsed_details['classes'][$class_name]);
         if (!empty($ParentClass)) {
             $SourceAnalyzer->log('Setting ' . $extends . ' as the parent of ' . $class_name);
             $ParentClass->tree->addChild($Class);
             $ParentClass->save();
         }
         $Class->methods = array();
         if (!empty($parsed_details['classes'][$class_name]['methods'])) {
             foreach ($parsed_details['classes'][$class_name]['methods'] as $method_name => $method_details) {
                 $Class->methods[] = $MethodInstance->updateMethodDetails($Class, $method_name, $method_details, $SourceAnalyzer);
             }
         }
         $Classes[] = $Class;
     }
     return $Classes;
 }
开发者ID:bermi,项目名称:akelos,代码行数:33,代码来源:klass.php

示例3: testHasParameters

 /**
  * @covers Puml\Model\Method::hasParameters
  */
 public function testHasParameters()
 {
     $this->assertFalse($this->object->hasParameters());
     $parameter = $this->getMock('\\Puml\\Model\\MethodParameter');
     $this->object->addParameter($parameter);
     $this->assertTrue($this->object->hasParameters());
 }
开发者ID:dannyvdsluijs,项目名称:puml,代码行数:10,代码来源:MethodTest.php

示例4: test___construct_returnsSelf_ifNamesIsString

 /**
  * __construct() should set the exception's names and message if names is string
  */
 public function test___construct_returnsSelf_ifNamesIsString()
 {
     $name = 'foo';
     $e = new Method($name);
     $this->assertEquals([$name], $e->getNames());
     $this->assertEquals("Method {$name} could not be found", $e->getMessage());
     return;
 }
开发者ID:jstewmc,项目名称:transient,代码行数:11,代码来源:MethodTest.php

示例5: testScenario1

 public function testScenario1()
 {
     $name = 'setDoctrine';
     $injectionKeys = array('doctrine');
     $method = new Method();
     $method->setName($name);
     $method->setInjectionKeys($injectionKeys);
     $this->assertEquals($name, $method->getName());
     $this->assertEquals($injectionKeys, $method->getInjectionKeys());
     $this->assertTrue($method->hasInjectionKeys());
     $this->assertEquals($method, new Method($method->__toArray()));
     $newMethod = new Method($method->__toArray());
     $this->assertEquals($method->__toArray(), $newMethod->__toArray());
 }
开发者ID:saxulum,项目名称:saxulum-controller-provider,代码行数:14,代码来源:MethodTest.php

示例6: print_debug_info

function print_debug_info($method, $endpoint, $headers)
{
    print "\n";
    print "Method: " . Method::nameForEnumValue($method) . "\n";
    print "Endpoint: " . $endpoint . "\n";
    print_r($headers);
}
开发者ID:ozrouter,项目名称:docs,代码行数:7,代码来源:simple_api_server_test_harness.php

示例7: _createFromReflection

 /**
  * @load
  * @param ReflectionMethod $reflection
  */
 protected function _createFromReflection($reflection)
 {
     $this->_type = Method::SpiritMethod;
     parent::_createFromReflection($reflection);
     //{ Add Views
     if ($this->isPublic()) {
         $viewPath = \Path::instance()->evaluate(':' . $this->controller()->project()->name() . '.*' . $this->controller()->name() . '.view.-' . $this->name());
         if (file_exists($viewPath)) {
             $dh = opendir($viewPath);
             $viewsFound = array();
             while (false !== ($file = readdir($dh))) {
                 if ($file != "." && $file != ".." && strtolower(pathinfo($file, PATHINFO_EXTENSION)) == 'php') {
                     $viewFilePath = rtrim($viewPath, '/') . "/{$file}";
                     $viewsFound[$file] = $viewFilePath;
                     $this->addView(SpiritView::create($this, pathinfo($file, PATHINFO_FILENAME)));
                 }
             }
             closedir($dh);
             if (array_key_exists('view.php', $viewsFound)) {
                 $this->setHasDefaultView();
             }
         }
     }
     //}
 }
开发者ID:neel,项目名称:bong,代码行数:29,代码来源:SpiritMethod.php

示例8: addFunctionsByNames

 /**
  * @param string[] $function_name_list
  * A list of function names to load type information for
  */
 private function addFunctionsByNames(array $function_name_list)
 {
     foreach ($function_name_list as $i => $function_name) {
         foreach (Method::methodListFromFunctionName($this, $function_name) as $method) {
             $this->addMethod($method);
         }
     }
 }
开发者ID:PHPforks,项目名称:phan,代码行数:12,代码来源:CodeBase.php

示例9: dispatch_array

 /**
  * Dispatch a method, whether a filter or function
  * @param Callable|string $method The method to call
  * @param array $args An array of arguments to be passed to the method
  * @return bool|mixed The return value from the dispatched method
  */
 public static function dispatch_array($method, $args = array())
 {
     if (is_callable($method)) {
         return call_user_func_array($method, $args);
     } elseif (is_string($method)) {
         array_unshift($args, $method, false);
         return call_user_func_array(Method::create('\\Habari\\Plugins', 'filter'), $args);
     }
     return false;
 }
开发者ID:habari,项目名称:system,代码行数:16,代码来源:method.php

示例10: _createFromReflection

 /**
  * @param ReflectionClass $reflection
  */
 protected function _createFromReflection($reflection)
 {
     $this->_className = $reflection->getName();
     $this->_endLine = $reflection->getEndLine();
     $this->_filePath = $reflection->getFileName();
     foreach ($reflection->getMethods() as $method) {
         //Method::create($this, $method);
         $this->addMethod(Method::create($this, $method));
     }
 }
开发者ID:neel,项目名称:bong,代码行数:13,代码来源:Controller.php

示例11: actionMethod

 function actionMethod($id = null)
 {
     if ($id == null) {
         $this->render('methods', array('methods' => Method::model()->findAll()));
     } else {
         $c = Method::model()->findByPk($id);
         if ($c == null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
         $this->render('method', array('method' => $c));
     }
 }
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:12,代码来源:SpellCheckController.php

示例12: forge

 /**
  * Gets a new instance of the Method class.
  *
  * @param   string      The name or instance of the Method to link to
  * @return  Method
  */
 public static function forge($method = 'default')
 {
     if (is_string($method)) {
         $set = \Method::instance($method) and $method = $set;
     }
     if ($method instanceof Method_Template) {
         if ($method->template(false) != null) {
             throw new \DomainException('Form instance already exists, cannot be recreated. Use instance() instead of forge() to retrieve the existing instance.');
         }
     }
     return new static($method);
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:18,代码来源:template.php

示例13: toDocTypeString

 /**
  * toDocTypeString
  * @param Method $method
  * @return string
  */
 public function toDocTypeString(Method $method)
 {
     $longestType = 0;
     $longestName = 0;
     foreach ($method->getParameters() as $parameter) {
         if (strlen($parameter->getType()) > $longestType) {
             $longestType = strlen($parameter->getType());
         }
         if (strlen($parameter->getName()) > $longestName) {
             $longestName = strlen($parameter->getName());
         }
     }
     $returnVar = '	 * @param';
     $returnVar .= ' ' . $this->getType() . str_repeat(' ', $longestType - strlen($this->getType()));
     $returnVar .= ' $' . $this->getName();
     if (strlen($this->getDescription()) > 0) {
         $returnVar .= str_repeat(' ', $longestName - strlen($this->getName())) . ' ' . $this->getDescription();
     }
     $returnVar .= "\n";
     return $returnVar;
 }
开发者ID:bullhorn,项目名称:fast-rest,代码行数:26,代码来源:Parameter.php

示例14: campaignAction

 function campaignAction()
 {
     $this->filter();
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
     $models = AFActiveDataProvider::models('Pixelrate', $this->params, $pagination);
     $pixelrates = $models->getAllGroupByCampaign();
     $id = AF::get($this->params, 'campaign_id');
     $methods = Method::model()->cache()->findAllInArray();
     Assets::js('jquery.form');
     $this->addToPageTitle('Pixel rates');
     $this->render('campaign', array('pixelrates' => $pixelrates, 'pagination' => $pagination, 'methods' => $methods, 'campaign_id' => $id));
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例15: _methodNval

 protected function _methodNval($name = '', $val = '', $met = '')
 {
     if ($met === "post") {
         return Method::post($name, $val);
     }
     if ($met === "get") {
         return Method::get($name, $val);
     }
     if ($met === "request") {
         return Method::request($name, $val);
     }
 }
开发者ID:erdidoqan,项目名称:znframework,代码行数:12,代码来源:Validation.php


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