Browse files

Fix whitespace only

  • Loading branch information...
1 parent 74f6643 commit 984e34c252d9f93afbd09eca83bfc29632f635b5 @nickl- nickl- committed Feb 7, 2013
View
1 bin/pear-package.php
@@ -69,3 +69,4 @@
$dom->formatOutput = true;
$dom->loadXML($package_data->asXML());
$dom->save($package_xml_file);
+
View
5 bin/phar-package.php
@@ -27,12 +27,13 @@
array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
$fileName = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
-
+
if (stream_resolve_include_path($fileName))
require $fileName;
});
LOADER
);
-$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
+$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
+
View
29 library/Respect/Config/Container.php
@@ -74,63 +74,63 @@ public function configure()
if (is_null($configurator))
return;
-
+
if (is_array($configurator))
return $this->loadArray($configurator);
-
+
if (file_exists($configurator))
if (is_file($configurator))
return $this->loadFile($configurator);
elseif (is_dir($configurator))
return $this->loadFileMultiple(scandir($configurator));
-
+
if (is_string($configurator))
return $this->loadString($configurator);
$this->configurator = $configurator;
throw new Argument("Invalid input. Must be a valid file or array");
}
-
+
public function getItem($name, $raw=false)
{
if ($this->configurator)
$this->configure();
if (!isset($this[$name]))
throw new Argument("Item $name not found");
-
+
if ($raw || !is_callable($this[$name]))
return $this[$name];
return $this->lazyLoad($name);
}
-
+
public function loadString($configurator)
{
$iniData = parse_ini_string($configurator, true);
if (false === $iniData || count($iniData) == 0)
throw new Argument("Invalid configuration string");
-
+
return $this->loadArray($iniData);
}
public function loadFileMultiple(array $configurators)
- {
+ {
return $this->loadStringMultiple(
- array_map('file_get_contents',
+ array_map('file_get_contents',
array_filter($configurators, 'is_file')
)
);
}
- public function loadStringMultiple(array $configurators)
+ public function loadStringMultiple(array $configurators)
{
uasort($configurators, function($first, $second) {
preg_match_all('#\[([^] ]+)\]#', $first, $usedOnFirst);
preg_match_all('#\[([^] ]+)\]#', $second, $usedOnSecond);
preg_match_all('#\[([^]]+) [^]]+\]#', $first, $declaredOnFirst);
preg_match_all('#\[([^]]+) [^]]+\]#', $second, $declaredOnSecond);
-
+
$usedOnFirst = array_unique($usedOnFirst[1]);
$usedOnSecond = array_unique($usedOnSecond[1]);
$declaredOnFirst = array_unique($declaredOnFirst[1]);
@@ -156,7 +156,7 @@ public function loadFile($configurator)
$iniData = parse_ini_file($configurator, true);
if (false === $iniData)
throw new Argument("Invalid configuration INI file");
-
+
return $this->loadArray($iniData);
}
@@ -170,7 +170,7 @@ public function __get($name)
{
return $this->getItem($name);
}
-
+
public function __set($name, $value)
{
if (isset($this[$name]) && $this[$name] instanceof Instantiator)
@@ -308,9 +308,10 @@ protected function lazyLoad($name)
$callback = $this[$name];
if ($callback instanceof Instantiator && $callback->getMode() != Instantiator::MODE_FACTORY) {
return $this[$name] = $callback();
- }
+ }
return $callback();
}
}
+
View
17 library/Respect/Config/Instantiator.php
@@ -47,9 +47,9 @@ public function getClassName()
public function getInstance($forceNew=false)
{
- if ($this->mode == static::MODE_FACTORY)
+ if ($this->mode == static::MODE_FACTORY)
$this->instance = null;
-
+
if ($this->instance && !$forceNew)
return $this->instance;
@@ -69,17 +69,17 @@ function($result) use ($className, &$instance, $staticMethods) {
if (empty($instance))
if (empty($this->constructor) || !$hasConstructor)
$instance = new $className;
- else
+ else
$instance = $this->reflection->newInstanceArgs(
$this->cleanupParams($this->constructor)
);
foreach ($this->propertySetters as $property => $value)
$instance->{$property} = $this->lazyLoad($value);
-
+
foreach ($this->methodCalls as $methodCalls)
$this->performMethodCalls($instance, $methodCalls);
-
+
return $this->instance = $instance;
}
@@ -145,7 +145,7 @@ protected function findConstructorParams(ReflectionClass $class)
protected function processValue($value)
{
if (is_array($value))
- foreach ($value as $valueKey => $subValue)
+ foreach ($value as $valueKey => $subValue)
$value[$valueKey] = $this->processValue($subValue);
return $value;
@@ -178,7 +178,7 @@ protected function performMethodCalls($class, array $methodCalls, $resultCallbac
list($methodName, $calls) = $methodCalls;
$resultCallback = $resultCallback ?: function(){};
- foreach ($calls as $arguments)
+ foreach ($calls as $arguments)
if (is_array($arguments))
$resultCallback(call_user_func_array(
array($class, $methodName),
@@ -190,4 +190,5 @@ protected function performMethodCalls($class, array $methodCalls, $resultCallbac
$resultCallback(call_user_func(array($class, $methodName)));
}
-}
+}
+
View
5 tests/bootstrap.php
@@ -3,8 +3,8 @@
date_default_timezone_set('UTC');
$pear_path = trim(`pear config-get php_dir`);
-set_include_path('../library'
- . PATH_SEPARATOR . $pear_path
+set_include_path('../library'
+ . PATH_SEPARATOR . $pear_path
. PATH_SEPARATOR . get_include_path());
/**
@@ -26,3 +26,4 @@ function($className) {
}
}
);
+
View
10 tests/library/Respect/Config/ContainerTest.php
@@ -211,7 +211,7 @@ public function testInstantiatorParamsBracketsReferences()
$this->assertEquals($expectedFoo, $instantiator->getParam('foo'));
$this->assertEquals($expectedBaz, $instantiator->getParam('baz'));
}
-
+
public function testGetItemLazyLoad()
{
$c = new Container;
@@ -233,7 +233,7 @@ public function testLazyLoadinessOnMultipleConfigLevels()
$c = new Container;
$c->loadArray(parse_ini_string($ini, true));
$this->assertFalse($GLOBALS['_SHIT_']);
- $GLOBALS['_SHIT_'] = false;
+ $GLOBALS['_SHIT_'] = false;
}
public function testSequencesConstructingLazy()
@@ -384,7 +384,7 @@ public function testByInstanceCallback2()
}
class Bar {}
-class Foo
+class Foo
{
function hello($some, Bar $bar) {
$this->bar = $bar;
@@ -398,10 +398,10 @@ public function __construct(){
}
}
-
class DatabaseWow {
public $c;
public function __construct($con) {
$this->c = $con;
}
-}
+}
+
View
11 tests/library/Respect/Config/InstantiatorTest.php
@@ -43,7 +43,7 @@ public function testMethodNoParams()
$s = $i->getInstance();
$this->assertTrue($s->ok);
}
-
+
public function testMethodWithObjectProperty()
{
$i = new Instantiator(__NAMESPACE__ . '\\testClass');
@@ -54,7 +54,7 @@ public function testMethodWithObjectProperty()
$testObject = $i->getInstance();
$this->assertTrue($testObject->myPropertyUsed);
}
-
+
public function testMethodSingleParam()
{
$i = new Instantiator(__NAMESPACE__ . '\\testClass');
@@ -109,7 +109,7 @@ public function testNestedInstantiators()
$s = $i1->getInstance();
$this->assertEquals('stdClass', get_class($s->foo));
}
-
+
public function testMagickInvoke()
{
$i1 = new Instantiator('stdClass');
@@ -133,7 +133,7 @@ public function __construct($foo=null, $bar=null, $baz=null)
if ($foo)
$this->ok = true;
}
-
+
public function usingProperty()
{
if ($this->myProperty == 'bar')
@@ -158,4 +158,5 @@ public function twoParams($ok, $ok2)
$this->ok = true;
}
-}
+}
+
View
17 tests/library/Respect/Config/Issues/EnviromentConfigurationTest.php
@@ -3,13 +3,13 @@
class EnviromentConfigurationTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @group issues
- * @ticket 30
- */
- public function testEnviromentConfiguration30()
- {
- $config = "
+ /**
+ * @group issues
+ * @ticket 30
+ */
+ public function testEnviromentConfiguration30()
+ {
+ $config = "
[development]
user = alganet
@@ -23,5 +23,6 @@ public function testEnviromentConfiguration30()
$config = array_merge($config[$ENVIRONMENT], $config);
$container = new Container($config);
$this->assertEquals($expected, $container->account); //respect
- }
+ }
}
+
View
47 tests/library/Respect/Config/Issues/LazyLoadTest.php
@@ -3,37 +3,38 @@
class LazyLoadTest extends \PHPUnit_Framework_TestCase
{
- /**
- * @group issues
- * @ticket 14
- */
- public function testLazyLoadedParameters()
- {
- $this->markTestSkipped('No solution found yet');
- $config = "
+ /**
+ * @group issues
+ * @ticket 14
+ */
+ public function testLazyLoadedParameters()
+ {
+ $this->markTestSkipped('No solution found yet');
+ $config = "
my_string = 'Hey you!'
[hello Respect\Config\MyLazyLoadedHelloWorld]
string = [my_string]
";
- $expected = 'Hello World!';
- $container = new Container($config);
- $container->my_string = $expected;
- $this->assertEquals($expected, (string) $container->hello);
- }
+ $expected = 'Hello World!';
+ $container = new Container($config);
+ $container->my_string = $expected;
+ $this->assertEquals($expected, (string) $container->hello);
+ }
}
class MyLazyLoadedHelloWorld
{
- protected $string;
+ protected $string;
- public function __construct($string)
- {
- $this->string = $string;
- }
+ public function __construct($string)
+ {
+ $this->string = $string;
+ }
+
+ public function __toString()
+ {
+ return $this->string;
+ }
+}
- public function __toString()
- {
- return $this->string;
- }
-}
View
3 tests/library/Respect/Config/Issues/StaticFactoryTest.php
@@ -23,4 +23,5 @@ public static function factory()
{
return new \DateTime();
}
-}
+}
+

0 comments on commit 984e34c

Please sign in to comment.