當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。