コード例 #1
0
ファイル: arr.php プロジェクト: quickpacket/noclayer
 /**
  * Tests Arr::to_assoc()
  *
  * @test
  */
 public function test_to_assoc_with_odd_number_of_elements()
 {
     $arr = array('foo', 'bar', 'baz');
     $expected = null;
     $this->assertEquals($expected, Arr::to_assoc($arr));
 }
コード例 #2
0
ファイル: uri.php プロジェクト: SainsburysTests/sainsburys
 /**
  * Converts the current URI segments to an associative array.  If
  * the URI has an odd number of segments, an empty value will be added.
  *
  * @param  int  segment number to start from. default value is the first segment
  * @return  array  the assoc array
  */
 public static function to_assoc($start = 1)
 {
     $segments = array_slice(static::segments(), $start - 1);
     count($segments) % 2 and $segments[] = null;
     return \Arr::to_assoc($segments);
 }
コード例 #3
0
ファイル: uri.php プロジェクト: reganhimself/KeeleProgrammers
 /**
  * Converts the current URI segments to an associative array.  If
  * the URI has an odd number of segments, null will be returned.
  *
  * @return  array|null  the array or null
  */
 public static function to_assoc()
 {
     return \Arr::to_assoc(static::segments());
 }
コード例 #4
0
ファイル: arr.php プロジェクト: SainsburysTests/sainsburys
 /**
  * Tests Arr::to_assoc()
  *
  * @test
  * @expectedException BadMethodCallException
  */
 public function test_to_assoc_with_odd_number_of_elements()
 {
     $arr = array('foo', 'bar', 'baz');
     Arr::to_assoc($arr);
 }