Skip to content
This repository
Browse code

Fix whitespace only

  • Loading branch information...
commit 984e34c252d9f93afbd09eca83bfc29632f635b5 1 parent 74f6643
Nick Lombard nickl- authored
1  bin/pear-package.php
@@ -69,3 +69,4 @@
69 69 $dom->formatOutput = true;
70 70 $dom->loadXML($package_data->asXML());
71 71 $dom->save($package_xml_file);
  72 +
5 bin/phar-package.php
@@ -27,7 +27,7 @@
27 27 array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
28 28
29 29 $fileName = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
30   -
  30 +
31 31 if (stream_resolve_include_path($fileName))
32 32 require $fileName;
33 33 });
@@ -35,4 +35,5 @@
35 35 LOADER
36 36 );
37 37
38   -$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
  38 +$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
  39 +
29 library/Respect/Config/Container.php
@@ -74,23 +74,23 @@ public function configure()
74 74
75 75 if (is_null($configurator))
76 76 return;
77   -
  77 +
78 78 if (is_array($configurator))
79 79 return $this->loadArray($configurator);
80   -
  80 +
81 81 if (file_exists($configurator))
82 82 if (is_file($configurator))
83 83 return $this->loadFile($configurator);
84 84 elseif (is_dir($configurator))
85 85 return $this->loadFileMultiple(scandir($configurator));
86   -
  86 +
87 87 if (is_string($configurator))
88 88 return $this->loadString($configurator);
89 89
90 90 $this->configurator = $configurator;
91 91 throw new Argument("Invalid input. Must be a valid file or array");
92 92 }
93   -
  93 +
94 94 public function getItem($name, $raw=false)
95 95 {
96 96 if ($this->configurator)
@@ -98,39 +98,39 @@ public function getItem($name, $raw=false)
98 98
99 99 if (!isset($this[$name]))
100 100 throw new Argument("Item $name not found");
101   -
  101 +
102 102 if ($raw || !is_callable($this[$name]))
103 103 return $this[$name];
104 104
105 105 return $this->lazyLoad($name);
106 106 }
107   -
  107 +
108 108 public function loadString($configurator)
109 109 {
110 110 $iniData = parse_ini_string($configurator, true);
111 111 if (false === $iniData || count($iniData) == 0)
112 112 throw new Argument("Invalid configuration string");
113   -
  113 +
114 114 return $this->loadArray($iniData);
115 115 }
116 116
117 117 public function loadFileMultiple(array $configurators)
118   - {
  118 + {
119 119 return $this->loadStringMultiple(
120   - array_map('file_get_contents',
  120 + array_map('file_get_contents',
121 121 array_filter($configurators, 'is_file')
122 122 )
123 123 );
124 124 }
125 125
126   - public function loadStringMultiple(array $configurators)
  126 + public function loadStringMultiple(array $configurators)
127 127 {
128 128 uasort($configurators, function($first, $second) {
129 129 preg_match_all('#\[([^] ]+)\]#', $first, $usedOnFirst);
130 130 preg_match_all('#\[([^] ]+)\]#', $second, $usedOnSecond);
131 131 preg_match_all('#\[([^]]+) [^]]+\]#', $first, $declaredOnFirst);
132 132 preg_match_all('#\[([^]]+) [^]]+\]#', $second, $declaredOnSecond);
133   -
  133 +
134 134 $usedOnFirst = array_unique($usedOnFirst[1]);
135 135 $usedOnSecond = array_unique($usedOnSecond[1]);
136 136 $declaredOnFirst = array_unique($declaredOnFirst[1]);
@@ -156,7 +156,7 @@ public function loadFile($configurator)
156 156 $iniData = parse_ini_file($configurator, true);
157 157 if (false === $iniData)
158 158 throw new Argument("Invalid configuration INI file");
159   -
  159 +
160 160 return $this->loadArray($iniData);
161 161 }
162 162
@@ -170,7 +170,7 @@ public function __get($name)
170 170 {
171 171 return $this->getItem($name);
172 172 }
173   -
  173 +
174 174 public function __set($name, $value)
175 175 {
176 176 if (isset($this[$name]) && $this[$name] instanceof Instantiator)
@@ -308,9 +308,10 @@ protected function lazyLoad($name)
308 308 $callback = $this[$name];
309 309 if ($callback instanceof Instantiator && $callback->getMode() != Instantiator::MODE_FACTORY) {
310 310 return $this[$name] = $callback();
311   - }
  311 + }
312 312
313 313 return $callback();
314 314 }
315 315
316 316 }
  317 +
17 library/Respect/Config/Instantiator.php
@@ -47,9 +47,9 @@ public function getClassName()
47 47
48 48 public function getInstance($forceNew=false)
49 49 {
50   - if ($this->mode == static::MODE_FACTORY)
  50 + if ($this->mode == static::MODE_FACTORY)
51 51 $this->instance = null;
52   -
  52 +
53 53 if ($this->instance && !$forceNew)
54 54 return $this->instance;
55 55
@@ -69,17 +69,17 @@ function($result) use ($className, &$instance, $staticMethods) {
69 69 if (empty($instance))
70 70 if (empty($this->constructor) || !$hasConstructor)
71 71 $instance = new $className;
72   - else
  72 + else
73 73 $instance = $this->reflection->newInstanceArgs(
74 74 $this->cleanupParams($this->constructor)
75 75 );
76 76
77 77 foreach ($this->propertySetters as $property => $value)
78 78 $instance->{$property} = $this->lazyLoad($value);
79   -
  79 +
80 80 foreach ($this->methodCalls as $methodCalls)
81 81 $this->performMethodCalls($instance, $methodCalls);
82   -
  82 +
83 83 return $this->instance = $instance;
84 84 }
85 85
@@ -145,7 +145,7 @@ protected function findConstructorParams(ReflectionClass $class)
145 145 protected function processValue($value)
146 146 {
147 147 if (is_array($value))
148   - foreach ($value as $valueKey => $subValue)
  148 + foreach ($value as $valueKey => $subValue)
149 149 $value[$valueKey] = $this->processValue($subValue);
150 150
151 151 return $value;
@@ -178,7 +178,7 @@ protected function performMethodCalls($class, array $methodCalls, $resultCallbac
178 178 list($methodName, $calls) = $methodCalls;
179 179 $resultCallback = $resultCallback ?: function(){};
180 180
181   - foreach ($calls as $arguments)
  181 + foreach ($calls as $arguments)
182 182 if (is_array($arguments))
183 183 $resultCallback(call_user_func_array(
184 184 array($class, $methodName),
@@ -190,4 +190,5 @@ protected function performMethodCalls($class, array $methodCalls, $resultCallbac
190 190 $resultCallback(call_user_func(array($class, $methodName)));
191 191 }
192 192
193   -}
  193 +}
  194 +
5 tests/bootstrap.php
@@ -3,8 +3,8 @@
3 3 date_default_timezone_set('UTC');
4 4
5 5 $pear_path = trim(`pear config-get php_dir`);
6   -set_include_path('../library'
7   - . PATH_SEPARATOR . $pear_path
  6 +set_include_path('../library'
  7 + . PATH_SEPARATOR . $pear_path
8 8 . PATH_SEPARATOR . get_include_path());
9 9
10 10 /**
@@ -26,3 +26,4 @@ function($className) {
26 26 }
27 27 }
28 28 );
  29 +
10 tests/library/Respect/Config/ContainerTest.php
@@ -211,7 +211,7 @@ public function testInstantiatorParamsBracketsReferences()
211 211 $this->assertEquals($expectedFoo, $instantiator->getParam('foo'));
212 212 $this->assertEquals($expectedBaz, $instantiator->getParam('baz'));
213 213 }
214   -
  214 +
215 215 public function testGetItemLazyLoad()
216 216 {
217 217 $c = new Container;
@@ -233,7 +233,7 @@ public function testLazyLoadinessOnMultipleConfigLevels()
233 233 $c = new Container;
234 234 $c->loadArray(parse_ini_string($ini, true));
235 235 $this->assertFalse($GLOBALS['_SHIT_']);
236   - $GLOBALS['_SHIT_'] = false;
  236 + $GLOBALS['_SHIT_'] = false;
237 237 }
238 238
239 239 public function testSequencesConstructingLazy()
@@ -384,7 +384,7 @@ public function testByInstanceCallback2()
384 384
385 385 }
386 386 class Bar {}
387   -class Foo
  387 +class Foo
388 388 {
389 389 function hello($some, Bar $bar) {
390 390 $this->bar = $bar;
@@ -398,10 +398,10 @@ public function __construct(){
398 398 }
399 399 }
400 400
401   -
402 401 class DatabaseWow {
403 402 public $c;
404 403 public function __construct($con) {
405 404 $this->c = $con;
406 405 }
407   -}
  406 +}
  407 +
11 tests/library/Respect/Config/InstantiatorTest.php
@@ -43,7 +43,7 @@ public function testMethodNoParams()
43 43 $s = $i->getInstance();
44 44 $this->assertTrue($s->ok);
45 45 }
46   -
  46 +
47 47 public function testMethodWithObjectProperty()
48 48 {
49 49 $i = new Instantiator(__NAMESPACE__ . '\\testClass');
@@ -54,7 +54,7 @@ public function testMethodWithObjectProperty()
54 54 $testObject = $i->getInstance();
55 55 $this->assertTrue($testObject->myPropertyUsed);
56 56 }
57   -
  57 +
58 58 public function testMethodSingleParam()
59 59 {
60 60 $i = new Instantiator(__NAMESPACE__ . '\\testClass');
@@ -109,7 +109,7 @@ public function testNestedInstantiators()
109 109 $s = $i1->getInstance();
110 110 $this->assertEquals('stdClass', get_class($s->foo));
111 111 }
112   -
  112 +
113 113 public function testMagickInvoke()
114 114 {
115 115 $i1 = new Instantiator('stdClass');
@@ -133,7 +133,7 @@ public function __construct($foo=null, $bar=null, $baz=null)
133 133 if ($foo)
134 134 $this->ok = true;
135 135 }
136   -
  136 +
137 137 public function usingProperty()
138 138 {
139 139 if ($this->myProperty == 'bar')
@@ -158,4 +158,5 @@ public function twoParams($ok, $ok2)
158 158 $this->ok = true;
159 159 }
160 160
161   -}
  161 +}
  162 +
17 tests/library/Respect/Config/Issues/EnviromentConfigurationTest.php
@@ -3,13 +3,13 @@
3 3
4 4 class EnviromentConfigurationTest extends \PHPUnit_Framework_TestCase
5 5 {
6   - /**
7   - * @group issues
8   - * @ticket 30
9   - */
10   - public function testEnviromentConfiguration30()
11   - {
12   - $config = "
  6 + /**
  7 + * @group issues
  8 + * @ticket 30
  9 + */
  10 + public function testEnviromentConfiguration30()
  11 + {
  12 + $config = "
13 13 [development]
14 14 user = alganet
15 15
@@ -23,5 +23,6 @@ public function testEnviromentConfiguration30()
23 23 $config = array_merge($config[$ENVIRONMENT], $config);
24 24 $container = new Container($config);
25 25 $this->assertEquals($expected, $container->account); //respect
26   - }
  26 + }
27 27 }
  28 +
47 tests/library/Respect/Config/Issues/LazyLoadTest.php
@@ -3,37 +3,38 @@
3 3
4 4 class LazyLoadTest extends \PHPUnit_Framework_TestCase
5 5 {
6   - /**
7   - * @group issues
8   - * @ticket 14
9   - */
10   - public function testLazyLoadedParameters()
11   - {
12   - $this->markTestSkipped('No solution found yet');
13   - $config = "
  6 + /**
  7 + * @group issues
  8 + * @ticket 14
  9 + */
  10 + public function testLazyLoadedParameters()
  11 + {
  12 + $this->markTestSkipped('No solution found yet');
  13 + $config = "
14 14 my_string = 'Hey you!'
15 15
16 16 [hello Respect\Config\MyLazyLoadedHelloWorld]
17 17 string = [my_string]
18 18 ";
19   - $expected = 'Hello World!';
20   - $container = new Container($config);
21   - $container->my_string = $expected;
22   - $this->assertEquals($expected, (string) $container->hello);
23   - }
  19 + $expected = 'Hello World!';
  20 + $container = new Container($config);
  21 + $container->my_string = $expected;
  22 + $this->assertEquals($expected, (string) $container->hello);
  23 + }
24 24 }
25 25
26 26 class MyLazyLoadedHelloWorld
27 27 {
28   - protected $string;
  28 + protected $string;
29 29
30   - public function __construct($string)
31   - {
32   - $this->string = $string;
33   - }
  30 + public function __construct($string)
  31 + {
  32 + $this->string = $string;
  33 + }
  34 +
  35 + public function __toString()
  36 + {
  37 + return $this->string;
  38 + }
  39 +}
34 40
35   - public function __toString()
36   - {
37   - return $this->string;
38   - }
39   -}
3  tests/library/Respect/Config/Issues/StaticFactoryTest.php
@@ -23,4 +23,5 @@ public static function factory()
23 23 {
24 24 return new \DateTime();
25 25 }
26   -}
  26 +}
  27 +

0 comments on commit 984e34c

Please sign in to comment.
Something went wrong with that request. Please try again.