當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Arr::callback方法代碼示例

本文整理匯總了PHP中Arr::callback方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arr::callback方法的具體用法?PHP Arr::callback怎麽用?PHP Arr::callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Arr的用法示例。


在下文中一共展示了Arr::callback方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_callback

 public function test_callback()
 {
     $callback = 'foo::bar(one,two,three)';
     // The valid callback and params
     $expect = array(array('foo', 'bar'), array('one', 'two', 'three'));
     $this->assert_equal(Arr::callback($callback), $expect);
 }
開發者ID:banks,項目名稱:unittest,代碼行數:7,代碼來源:arr.php

示例2: test_callback

	/**
	 * Tests Arr::callback()
	 *
	 * @test
	 * @dataProvider provider_callback
	 * @param string $str       String to parse
	 * @param array  $expected  Callback and its parameters
	 */
	public function test_callback($str, $expected)
	{
		$result = Arr::callback($str);

		$this->assertSame(2, count($result));
		$this->assertSame($expected, $result);
	}
開發者ID:nevermlnd,項目名稱:cv,代碼行數:15,代碼來源:ArrTest.php

示例3: _bulk_update

 /**
  * Bulk updates
  *
  * @param  array  $post
  * @uses   Post::bulk_actions
  * @uses   Arr::callback
  */
 private function _bulk_update($post)
 {
     $operations = Post::bulk_actions(FALSE, 'blog');
     $operation = $operations[$post['operation']];
     $blogs = array_filter($post['blogs']);
     // Filter out unchecked pages
     if ($operation['callback']) {
         list($func, $params) = Arr::callback($operation['callback']);
         if (isset($operation['arguments'])) {
             $args = array_merge(array($blogs), $operation['arguments']);
         } else {
             $args = array($blogs);
         }
         // set model name
         $args['type'] = 'blog';
         // execute the bulk operation
         call_user_func_array($func, $args);
     }
 }
開發者ID:MenZil-Team,項目名稱:cms,代碼行數:26,代碼來源:blog.php

示例4: _action_callback

	/**
	 * Performs a callback on the error
	 *
	 * @param	 array	$options	Options from config
	 * @return	void
	 */
	protected function _action_callback(array $options = array())
	{
		$callback = Arr::get($options, 'callback');
		@list($method,) = Arr::callback($callback);
		if (is_callable($method))
		{
			call_user_func($method, $this);
		}
	}
開發者ID:nexeck,項目名稱:kohana-errors,代碼行數:15,代碼來源:error.php

示例5: _bulk_update

 /**
  * Bulk update
  *
  * Executes the bulk operation
  *
  * @param  array $post  Array of comments
  * @uses   Comment::bulk_actions
  * @uses   Arr::callback
  * @uses   Arr::merge
  */
 private function _bulk_update($post)
 {
     // Filter out unchecked comments
     $comments = array_filter($post['comments']);
     $operations = Comment::bulk_actions(FALSE);
     $operation = $operations[$post['operation']];
     if ($operation['callback']) {
         list($func, $params) = Arr::callback($operation['callback']);
         if (isset($operation['arguments'])) {
             $args = Arr::merge(array($comments), $operation['arguments']);
         } else {
             $args = array($comments);
         }
         // Execute the bulk operation
         call_user_func_array($func, $args);
     }
 }
開發者ID:MenZil-Team,項目名稱:cms,代碼行數:27,代碼來源:comment.php


注:本文中的Arr::callback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。