本文整理汇总了PHP中Method类的典型用法代码示例。如果您正苦于以下问题:PHP Method类的具体用法?PHP Method怎么用?PHP Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Method类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: isParamType
/**
* validate param type for {$offset}th param
* !!!will return true if we are not sure about the type!!!
*
* @param int $offset Param offset
* @param string $type Doctype styled type
* @return bool
*/
public function isParamType($offset, $expectedType)
{
$param = $this->_params[$offset];
$value = $param->value;
$type = self::TYPE_MIXED;
if ($param->value instanceof \PHPParser_Node_Expr_MethodCall) {
$method = new Method($param->value->name, $param->value->args, null);
$type = $method->getReturnType();
} elseif ($param->value instanceof \PHPParser_Node_Scalar_String || $param->value instanceof \PHPParser_Node_Scalar_ClassConst || $param->value instanceof \PHPParser_Node_Scalar_DirConst || $param->value instanceof \PHPParser_Node_Scalar_FileConst || $param->value instanceof \PHPParser_Node_Scalar_FuncConst || $param->value instanceof \PHPParser_Node_Scalar_LineConst || $param->value instanceof \PHPParser_Node_Scalar_MethodConst || $param->value instanceof \PHPParser_Node_Scalar_NSConst || $param->value instanceof \PHPParser_Node_Scalar_TraitConst) {
$type = self::TYPE_STRING;
} elseif ($param->value instanceof \PHPParser_Node_Scalar_DNumber) {
$type = self::TYPE_FLOAT;
} elseif ($param->value instanceof \PHPParser_Node_Scalar_LNumber) {
$type = self::TYPE_INT;
} elseif ($param->value instanceof \PHPParser_Node_Expr_Array) {
$type = self::TYPE_FLOAT;
}
if (in_array($expectedType, array(self::TYPE_UNKNOWN, self::TYPE_MIXED))) {
return true;
}
return $type == $expectedType;
}
开发者ID:djnewtown,项目名称:judge,代码行数:30,代码来源:Method.php
示例17: add_system_rules
/**
* Add pre-defined rules to an array of rules only if rules with their names don't already exist
*
* @param array $rules An array of RewriteRule objects
* @return array An array of rules with the system rules potentially added
*/
public static function add_system_rules($rules)
{
$default_rules = array(array('name' => 'display_home', 'parse_regex' => '#^(?:page/(?P<page>0|1))?/?$#', 'build_str' => '(page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_home', 'priority' => 1000, 'description' => 'Homepage (index) display'), array('name' => 'display_entries', 'parse_regex' => '#^(?:page/(?P<page>[2-9]|[1-9][0-9]+))/?$#', 'build_str' => '(page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_entries', 'priority' => 999, 'description' => 'Display multiple entries'), array('name' => 'display_entries_by_date', 'parse_regex' => '#^(?P<year>[1,2]{1}[\\d]{3})(?:/(?P<month>[\\d]{2}))?(?:/(?P<day>[\\d]{2}))?(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$year}(/{$month})(/{$day})(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_date', 'priority' => 2, 'description' => 'Displays posts for a specific date.'), array('name' => 'display_entries_by_tag', 'parse_regex' => '#^tag/(?P<tag>[^/]*)(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => 'tag/{$tag}(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_tag', 'priority' => 5, 'description' => 'Return posts matching specified tag.', 'parameters' => serialize(array('require_match' => Method::create('\\Habari\\Tag', 'rewrite_tag_exists')))), array('name' => 'display_entry', 'parse_regex' => '#^(?P<slug>[^/]+)(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$slug}(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_post', 'priority' => 100, 'description' => 'Return entry matching specified slug', 'parameters' => serialize(array('require_match' => Method::create('\\Habari\\Posts', 'rewrite_match_type'), 'content_type' => 'entry', 'request_types' => array('display_post')))), array('name' => 'display_page', 'parse_regex' => '#^(?P<slug>[^/]+)(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$slug}(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_post', 'priority' => 100, 'description' => 'Return page matching specified slug', 'parameters' => serialize(array('require_match' => Method::create('\\Habari\\Posts', 'rewrite_match_type'), 'content_type' => 'page', 'request_types' => array('display_post')))), array('name' => 'display_search', 'parse_regex' => '#^search(?:/(?P<criteria>[^/]+))?(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => 'search(/{$criteria})(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'search', 'priority' => 8, 'description' => 'Searches posts'), array('name' => 'display_404', 'parse_regex' => '/^.*$/', 'build_str' => '', 'handler' => 'UserThemeHandler', 'action' => 'display_404', 'priority' => 9999, 'description' => 'Displays an error page when a URL is not matched.'), array('name' => 'display_post', 'parse_regex' => '#^(?P<slug>[^/]+)(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$slug}(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_post', 'priority' => 9998, 'description' => 'Fallback to return post matching specified slug if no content_type match'), array('name' => 'submit_feedback', 'parse_regex' => '#^(?P<id>[0-9]+)/feedback/?$#i', 'build_str' => '{$id}/feedback', 'handler' => 'FeedbackHandler', 'action' => 'add_comment', 'priority' => 8, 'description' => 'Adds a comment to a post'), array('name' => 'display_dashboard', 'parse_regex' => '#^admin/?$#', 'build_str' => 'admin', 'handler' => 'AdminDashboardHandler', 'action' => 'dashboard', 'priority' => 4, 'description' => 'Display the admin dashboard'), array('name' => 'display_publish', 'parse_regex' => '#^admin/publish/(?P<content_type_name>[^/]+)(?:/(?P<id>.+))?/?$#', 'build_str' => 'admin/publish/{$content_type_name}(/{$id})', 'handler' => 'AdminPostsHandler', 'action' => 'publish', 'priority' => 4, 'description' => 'Manage publishing posts'), array('name' => 'display_posts', 'parse_regex' => '#^admin/posts/?$#', 'build_str' => 'admin/posts', 'handler' => 'AdminPostsHandler', 'action' => 'posts', 'priority' => 4, 'description' => 'Manage posts'), array('name' => 'delete_post', 'parse_regex' => '#^admin/delete_post/?$#', 'build_str' => 'admin/delete_post', 'handler' => 'AdminPostsHandler', 'action' => 'delete_post', 'priority' => 4, 'description' => 'Delete a post'), array('name' => 'user_profile', 'parse_regex' => '#^admin/user/(?P<user>[^/]+)/?$#', 'build_str' => 'admin/user/{$user}', 'handler' => 'AdminUsersHandler', 'action' => 'user', 'priority' => 4, 'description' => 'The profile page for a specific user'), array('name' => 'display_users', 'parse_regex' => '#^admin/users/?$#', 'build_str' => 'admin/users', 'handler' => 'AdminUsersHandler', 'action' => 'users', 'priority' => 4, 'description' => 'Manage users'), array('name' => 'own_user_profile', 'parse_regex' => '#^admin/user/?$#', 'build_str' => 'admin/user', 'handler' => 'AdminUsersHandler', 'action' => 'user', 'priority' => 4, 'description' => 'The profile page for a specific user'), array('name' => 'display_themes', 'parse_regex' => '#^admin/themes/?$#', 'build_str' => 'admin/themes', 'handler' => 'AdminThemesHandler', 'action' => 'themes', 'priority' => 4, 'description' => 'Manage themes'), array('name' => 'activate_theme', 'parse_regex' => '#^admin/activate_theme/?$#', 'build_str' => 'admin/activate_theme', 'handler' => 'AdminThemesHandler', 'action' => 'activate_theme', 'priority' => 4, 'description' => 'Activate a theme'), array('name' => 'preview_theme', 'parse_regex' => '#^admin/preview_theme/?$#', 'build_str' => 'admin/preview_theme', 'handler' => 'AdminThemesHandler', 'action' => 'preview_theme', 'priority' => 4, 'description' => 'Preview a theme'), array('name' => 'configure_block', 'parse_regex' => '#^admin/configure_block/?$#i', 'build_str' => 'admin/configure_block', 'handler' => 'AdminThemesHandler', 'action' => 'configure_block', 'priority' => 4, 'description' => 'Configure a block in an iframe'), array('name' => 'display_plugins', 'parse_regex' => '#^admin/plugins(?:/(?P<configure>[0-9a-f]{8})/(?P<action>.+))?/?$#', 'build_str' => 'admin/plugins(/{$configure}/{$action})', 'handler' => 'AdminPluginsHandler', 'action' => 'plugins', 'priority' => 4, 'description' => 'Manage plugins'), array('name' => 'plugin_toggle', 'parse_regex' => '#^admin/plugin_toggle/?$#', 'build_str' => 'admin/plugin_toggle', 'handler' => 'AdminPluginsHandler', 'action' => 'plugin_toggle', 'priority' => 4, 'description' => 'Activate or deactivate a plugin'), array('name' => 'display_options', 'parse_regex' => '#^admin/options/?$#', 'build_str' => 'admin/options', 'handler' => 'AdminOptionsHandler', 'action' => 'options', 'priority' => 4, 'description' => 'The options page for the blog'), array('name' => 'display_comments', 'parse_regex' => '#^admin/comments/?$#', 'build_str' => 'admin/comments', 'handler' => 'AdminCommentsHandler', 'action' => 'comments', 'priority' => 4, 'description' => 'Manage comments'), array('name' => 'edit_comment', 'parse_regex' => '#^admin/comment/(?P<id>[0-9]+)/?$#i', 'build_str' => 'admin/comment/{$id}', 'handler' => 'AdminCommentsHandler', 'action' => 'comment', 'priority' => 4, 'description' => 'Edit a comment'), array('name' => 'display_groups', 'parse_regex' => '#^admin/groups/?$#', 'build_str' => 'admin/groups', 'handler' => 'AdminGroupsHandler', 'action' => 'groups', 'priority' => 4, 'description' => 'Manage groups'), array('name' => 'display_group', 'parse_regex' => '#^admin/group/(?P<id>[0-9]+)/?$#i', 'build_str' => 'admin/group/{$id}', 'handler' => 'AdminGroupsHandler', 'action' => 'group', 'priority' => 4, 'description' => 'Manage a group'), array('name' => 'display_tags', 'parse_regex' => '#^admin/tags/?$#i', 'build_str' => 'admin/tags', 'handler' => 'AdminTagsHandler', 'action' => 'tags', 'priority' => 4, 'description' => 'Manage tags'), array('name' => 'display_logs', 'parse_regex' => '#^admin/logs/?$#i', 'build_str' => 'admin/logs', 'handler' => 'AdminLogsHandler', 'action' => 'logs', 'priority' => 4, 'description' => 'Manage logs'), array('name' => 'display_import', 'parse_regex' => '#^admin/import/?$#i', 'build_str' => 'admin/import', 'handler' => 'AdminImportHandler', 'action' => 'import', 'priority' => 4, 'description' => 'Manage importing content'), array('name' => 'get_locale', 'parse_regex' => '#^admin/locale/?$#i', 'build_str' => 'admin/locale', 'handler' => 'AdminLocaleHandler', 'action' => 'locale', 'priority' => 4, 'description' => 'Fetch the locale data as javascript'), array('name' => 'display_sysinfo', 'parse_regex' => '#^admin/sysinfo/?$#i', 'build_str' => 'admin/sysinfo', 'handler' => 'AdminHandler', 'action' => 'sysinfo', 'priority' => 4, 'description' => 'Display system info'), array('name' => 'admin', 'parse_regex' => '#^admin(?:/?$|/(?P<page>[^/]*))/?$#i', 'build_str' => 'admin/({$page})', 'handler' => 'AdminHandler', 'action' => 'admin', 'priority' => 6, 'description' => 'An admin action'), array('name' => 'admin_ajax_dashboard', 'parse_regex' => '#^admin_ajax/(?P<context>dashboard)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminDashboardHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for the admin dashboard'), array('name' => 'admin_ajax_posts', 'parse_regex' => '#^admin_ajax/(?P<context>posts)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminPostsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for the managing posts'), array('name' => 'admin_ajax_update_posts', 'parse_regex' => '#^admin_ajax/(?P<context>update_posts)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminPostsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for the updating posts'), array('name' => 'admin_ajax_facets', 'parse_regex' => '#^admin_ajax/(?P<context>facets)/(?P<page>manage|tags)/(?P<component>facets|values)/?$#i', 'build_str' => 'admin_ajax/{$context}/{$page}/{$component}', 'handler' => 'AdminHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for retrieving post search facets'), array('name' => 'admin_ajax_media', 'parse_regex' => '#^admin_ajax/(?P<context>media)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminPostsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling from media silos'), array('name' => 'admin_ajax_media_panel', 'parse_regex' => '#^admin_ajax/(?P<context>media_panel)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminPostsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling from media panels'), array('name' => 'admin_ajax_media_upload', 'parse_regex' => '#^admin_ajax/(?P<context>media_upload)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminPostsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling from media panel uploads'), array('name' => 'admin_ajax_add_block', 'parse_regex' => '#^admin_ajax/(?P<context>add_block)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminThemesHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for adding a block', 'parameters' => serialize(array('require_permission' => array('manage_theme_config' => true)))), array('name' => 'admin_ajax_delete_block', 'parse_regex' => '#^admin_ajax/(?P<context>delete_block)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminThemesHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for deleting a block'), array('name' => 'admin_ajax_save_areas', 'parse_regex' => '#^admin_ajax/(?P<context>save_areas)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminThemesHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for saving areas'), array('name' => 'admin_ajax_comments', 'parse_regex' => '#^admin_ajax/(?P<context>comments)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminCommentsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for managing comments'), array('name' => 'admin_ajax_update_comment', 'parse_regex' => '#^admin_ajax/(?P<context>update_comment)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminCommentsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for updating a comment'), array('name' => 'admin_ajax_groups', 'parse_regex' => '#^admin_ajax/(?P<context>groups)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminGroupsHandler', 'action' => 'admin_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling for managing groups'), array('name' => 'admin_ajax_update_groups', 'parse_regex' => '#^admin_ajax/(?P<context>update_groups)/?$#', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminGroupsHandler', 'action' => 'admin_ajax', 'priority' => 4, 'description' => 'Authenticated ajax handler for updating a group'), array('name' => 'admin_ajax_tags', 'parse_regex' => '#^admin_ajax/(?P<context>tags)/?$#', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminTagsHandler', 'action' => 'admin_ajax', 'priority' => 4, 'description' => 'Authenticated ajax handler for managing tags'), array('name' => 'admin_ajax_get_tags', 'parse_regex' => '#^admin_ajax/(?P<context>get_tags)/?$#', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminTagsHandler', 'action' => 'admin_ajax', 'priority' => 4, 'description' => 'Authenticated ajax handler for retrieving tags'), array('name' => 'admin_ajax_logs', 'parse_regex' => '#^admin_ajax/(?P<context>logs)/?$#', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminLogsHandler', 'action' => 'admin_ajax', 'priority' => 4, 'description' => 'Authenticated ajax handler for managing logs'), array('name' => 'admin_ajax_delete_logs', 'parse_regex' => '#^admin_ajax/(?P<context>delete_logs)/?$#', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminLogsHandler', 'action' => 'admin_ajax', 'priority' => 4, 'description' => 'Authenticated ajax handler for deleting logs'), array('name' => 'admin_ajax', 'parse_regex' => '#^admin_ajax/(?P<context>[^/]+)/?$#i', 'build_str' => 'admin_ajax/{$context}', 'handler' => 'AdminHandler', 'action' => 'admin_ajax', 'priority' => 10, 'description' => 'Authenticated ajax handling for the admin'), array('name' => 'auth', 'parse_regex' => '#^auth/(?P<page>[^/]*)$#i', 'build_str' => 'auth/{$page}', 'handler' => 'UserHandler', 'action' => '{$page}', 'priority' => 7, 'description' => 'A user action or display, for instance the login screen'), array('name' => 'ajax', 'parse_regex' => '#^ajax/(?P<context>[^/]+)/?$#i', 'build_str' => 'ajax/{$context}', 'handler' => 'AjaxHandler', 'action' => 'ajax', 'priority' => 8, 'description' => 'Ajax handling'), array('name' => 'auth_ajax', 'parse_regex' => '#^auth_ajax/(?P<context>[^/]+)/?$#i', 'build_str' => 'auth_ajax/{$context}', 'handler' => 'AjaxHandler', 'action' => 'auth_ajax', 'priority' => 8, 'description' => 'Authenticated ajax handling'), array('name' => 'rsd', 'parse_regex' => '/^rsd$/i', 'build_str' => 'rsd', 'handler' => 'AtomHandler', 'action' => 'rsd', 'priority' => 1, 'description' => 'RSD output'), array('name' => 'atom_entry', 'parse_regex' => '#^(?P<slug>[^/]+)/atom/?$#i', 'build_str' => '{$slug}/atom', 'handler' => 'AtomHandler', 'action' => 'entry', 'priority' => 8, 'description' => 'Atom Publishing Protocol'), array('name' => 'atom_feed', 'parse_regex' => '#^atom/(?P<index>[^/]+)(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => 'atom/{$index}(/page/{$page})', 'handler' => 'AtomHandler', 'action' => 'collection', 'priority' => 8, 'description' => 'Atom collection'), array('name' => 'atom_feed_comments', 'parse_regex' => '#^atom/comments(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => 'atom/comments(/page/{$page})', 'handler' => 'AtomHandler', 'action' => 'comments', 'priority' => 7, 'description' => 'Entries comments'), array('name' => 'atom_feed_tag', 'parse_regex' => '#^tag/(?P<tag>[^/]+)/atom(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => 'tag/{$tag}/atom(/page/{$page})', 'handler' => 'AtomHandler', 'action' => 'tag_collection', 'priority' => 8, 'description' => 'Atom Tag Collection', 'parameters' => serialize(array('require_match' => Method::create('\\Habari\\Tag', 'rewrite_tag_exists')))), array('name' => 'atom_feed_entry_comments', 'parse_regex' => '#^(?P<slug>[^/]+)/atom/comments(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$slug}/atom/comments(/page/{$page})', 'handler' => 'AtomHandler', 'action' => 'entry_comments', 'priority' => 8, 'description' => 'Entry comments'), array('name' => 'atom_feed_page_comments', 'parse_regex' => '#^(?P<slug>[^/]+)/atom/comments(?:/page/(?P<page>\\d+))?/?$#i', 'build_str' => '{$slug}/atom/comments(/page/{$page})', 'handler' => 'AtomHandler', 'action' => 'entry_comments', 'priority' => 8, 'description' => 'Page comments'), array('name' => 'atompub_servicedocument', 'parse_regex' => '/^atom$/i', 'build_str' => 'atom', 'handler' => 'AtomHandler', 'action' => 'introspection', 'priority' => 1, 'description' => 'Atom introspection'), array('name' => 'cron', 'parse_regex' => '#^cron/(?P<time>[0-9.]+)/?$#i', 'build_str' => 'cron/{$time}', 'handler' => 'CronHandler', 'action' => 'poll_cron', 'priority' => 1, 'description' => 'Asyncronous cron processing'), array('name' => 'xmlrpc', 'parse_regex' => '#^xmlrpc/?$#i', 'build_str' => 'xmlrpc', 'handler' => 'XMLRPCServer', 'action' => 'xmlrpc_call', 'priority' => 8, 'description' => 'Handle incoming XMLRPC requests.'));
$default_rules = Plugins::filter('default_rewrite_rules', $default_rules);
$default_rules_properties = array('is_active' => 1, 'rule_class' => RewriteRule::RULE_SYSTEM);
$rule_names = array_flip(Utils::array_map_field($rules, 'name'));
foreach ($default_rules as $default_rule) {
if (!isset($rule_names[$default_rule['name']])) {
$rule_properties = array_merge($default_rule, $default_rules_properties);
$rules[] = new RewriteRule($rule_properties);
}
}
return $rules;
}
开发者ID:habari,项目名称:system,代码行数:20,代码来源:rewriterules.php
示例18: measure
/**
* @return float The time it took to execute in milliseconds
*/
private function measure()
{
$closure = $this->method->getMethod();
if ($this->parameter !== null) {
// Make sure getParameter() won't be measured.
$parameterValue = $this->parameter->getParameter();
$start = microtime(true);
$closure($this->iterationCount, $parameterValue);
return (microtime(true) - $start) * 1000.0;
}
// Have to omit the parameter because the closure won't accept it.
$start = microtime(true);
$closure($this->iterationCount);
return (microtime(true) - $start) * 1000.0;
}
开发者ID:nochso,项目名称:benchmark,代码行数:18,代码来源:Timer.php
示例19: add_routes
public function add_routes()
{
$routes = func_get_args();
\_u::each($routes, function ($route, $index) {
$method = key($route);
$items = $route[$method];
if (!Method::has_method(strtolower($method))) {
continue;
}
$route = new Route($items);
$route->method = new Method($method);
if (isset($items['headers']) && is_array($items['headers'])) {
$route->headers = Headers::set_for_route($items['headers']);
}
$this->routes[] = $route;
});
}
开发者ID:markzero,项目名称:wp-on-routes,代码行数:17,代码来源:main.php
示例20: loadConfig
public function loadConfig(Model\Aop $aop)
{
foreach ($this->objectReflectionClass->getMethods() as $reflectionMethod) {
$annotations = $this->reader->getMethodAnnotations($reflectionMethod);
$beforeAdvices = [];
$afterAdvices = [];
$insteadAdvices = [];
$canceled = null;
$group = null;
switch (get_class($annotation)) {
case Annotation::After:
$afterAdvices[] = new Model\Advice($annotation->context, $annotation->method, $annotation->args);
break;
case Annotation::Before:
$beforeAdvices[] = new Model\Advice($annotation->context, $annotation->method, $annotation->args);
break;
case Annotation::Cancel:
$canceled = true;
break;
case Annotation::Group:
$group = $annotation->id;
break;
case Annotation::Instead:
$insteadAdvices[] = new Model\Advice($annotation->context, $annotation->method, $annotation->args);
break;
}
$method = new Method();
if (!empty($beforeAdvices)) {
$method->setBeforeAdvices($beforeAdvices);
}
if (!empty($afterAdvices)) {
$method->setAfterAdvices($afterAdvices);
}
if (!empty($insteadAdvices)) {
$method->setInsteadAdvices($insteadAdvices);
}
if (isset($group)) {
$method->setGroup($group);
}
if (isset($canceled)) {
$method->setCanceled($canceled);
}
$aop->addMethod($method);
}
}
开发者ID:kassko,项目名称:aop-php,代码行数:45,代码来源:AnnotationLoader.php
注:本文中的Method类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论