@@ -24,6 +24,9 @@ |
||
| 24 | 24 | $this->env = $env; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $key |
|
| 29 | + */ |
|
| 27 | 30 | public function multisort($array, $key, $reverse = false) |
| 28 | 31 | { |
| 29 | 32 | $extractKey = function ($element, $key) use (&$extractKey) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function multisort($array, $key, $reverse = false) |
| 28 | 28 | { |
| 29 | - $extractKey = function ($element, $key) use (&$extractKey) { |
|
| 29 | + $extractKey = function($element, $key) use (&$extractKey) { |
|
| 30 | 30 | if (strpos($key, '.') === false) { |
| 31 | 31 | return is_object($element) ? $element->$key : $element[$key]; |
| 32 | 32 | } else { |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | - $keys = array_map(function ($el) use ($key, $extractKey) { |
|
| 38 | + $keys = array_map(function($el) use ($key, $extractKey) { |
|
| 39 | 39 | return $extractKey($el, $key); |
| 40 | 40 | }, $array); |
| 41 | - $sorted = array_map(function ($el) { |
|
| 41 | + $sorted = array_map(function($el) { |
|
| 42 | 42 | return $el; |
| 43 | 43 | }, $array); |
| 44 | 44 | array_multisort($keys, $reverse ? SORT_DESC : SORT_ASC, $sorted); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function load(array $configs, ContainerBuilder $container) |
| 17 | 17 | { |
| 18 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 18 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 19 | 19 | $loader->load('services.yml'); |
| 20 | 20 | $loader->load('controllers.yml'); |
| 21 | 21 | $loader->load('contentful.yml'); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | use Symfony\Component\HttpFoundation\Request; |
| 8 | 8 | use Symfony\Component\HttpFoundation\Response; |
| 9 | 9 | |
| 10 | -require_once __DIR__ . '/../../../../../../abraham/twitteroauth/twitteroauth/twitteroauth.php'; |
|
| 10 | +require_once __DIR__.'/../../../../../../abraham/twitteroauth/twitteroauth/twitteroauth.php'; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * This controller provides the twitter stream for the social board. |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function itShouldSortAnArray() |
| 26 | 26 | { |
| 27 | - $data = array( |
|
| 27 | + $data = array( |
|
| 28 | 28 | array('a' => 'b'), |
| 29 | 29 | array('a' => 'a'), |
| 30 | 30 | array('a' => 'c'), |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function itShouldSortRevers() |
| 44 | 44 | { |
| 45 | - $data = array( |
|
| 45 | + $data = array( |
|
| 46 | 46 | array('a' => 'b'), |
| 47 | 47 | array('a' => 'a'), |
| 48 | 48 | array('a' => 'c'), |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function itShouldSortAnArrayByANestedKey() |
| 62 | 62 | { |
| 63 | - $data = array( |
|
| 63 | + $data = array( |
|
| 64 | 64 | array('a' => array('a' => '5', 'b' => 'a')), |
| 65 | 65 | array('a' => array('a' => '1', 'b' => 'b')), |
| 66 | 66 | array('a' => array('a' => '-100', 'b' => 'c')), |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function itShouldSortAnArrayOfObjectsByANestedKey() |
| 84 | 84 | { |
| 85 | - $data = array( |
|
| 86 | - (object)array('a' => (object)array('a' => '5', 'b' => 'a')), |
|
| 87 | - (object)array('a' => (object)array('a' => '1', 'b' => 'b')), |
|
| 88 | - (object)array('a' => (object)array('a' => '-100', 'b' => 'c')), |
|
| 85 | + $data = array( |
|
| 86 | + (object) array('a' => (object) array('a' => '5', 'b' => 'a')), |
|
| 87 | + (object) array('a' => (object) array('a' => '1', 'b' => 'b')), |
|
| 88 | + (object) array('a' => (object) array('a' => '-100', 'b' => 'c')), |
|
| 89 | 89 | ); |
| 90 | 90 | $sorted = $this->createTestObject()->multisort($data, 'a.a'); |
| 91 | 91 | $this->assertNotEquals($data, $sorted); |
| 92 | 92 | $this->assertEquals($sorted, array( |
| 93 | - (object)array('a' => (object)array('a' => '-100', 'b' => 'c')), |
|
| 94 | - (object)array('a' => (object)array('a' => '1', 'b' => 'b')), |
|
| 95 | - (object)array('a' => (object)array('a' => '5', 'b' => 'a')) |
|
| 93 | + (object) array('a' => (object) array('a' => '-100', 'b' => 'c')), |
|
| 94 | + (object) array('a' => (object) array('a' => '1', 'b' => 'b')), |
|
| 95 | + (object) array('a' => (object) array('a' => '5', 'b' => 'a')) |
|
| 96 | 96 | )); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -spl_autoload_register(function ($class) { |
|
| 3 | +spl_autoload_register(function($class) { |
|
| 4 | 4 | if (strpos($class, 'Foundershub') === 0) { |
| 5 | 5 | $parts = explode('\\', $class); |
| 6 | 6 | array_shift($parts); |
| 7 | - require_once __DIR__ . '/../Foundershub/' . join(DIRECTORY_SEPARATOR, $parts) . '.php'; |
|
| 7 | + require_once __DIR__.'/../Foundershub/'.join(DIRECTORY_SEPARATOR, $parts).'.php'; |
|
| 8 | 8 | return true; |
| 9 | 9 | } |
| 10 | 10 | return false; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Doctrine\Common\Annotations\AnnotationRegistry; |
| 4 | 4 | |
| 5 | -if (!is_file($loaderFile = __DIR__ . '/../vendor/autoload.php')) { |
|
| 5 | +if (!is_file($loaderFile = __DIR__.'/../vendor/autoload.php')) { |
|
| 6 | 6 | throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?'); |
| 7 | 7 | } |
| 8 | 8 | |