Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- added default path in switch

- fixed some comment typos and removed unnecessary whitespaces
  • Loading branch information...
commit 8746c0a8b4a1c925d17504cc71efeab02f53a613 1 parent ec45a52
Michael Kliewe authored
View
4 demo/Framework.php
@@ -14,7 +14,7 @@ class Factory extends AbstractFactory
* @var OriginalFactory
*/
protected $originalFactory;
-
+
/**
* @var array
*/
@@ -62,6 +62,8 @@ public function getInstance($class)
return new X();
case 'spriebsch\\factory\\demo\\framework\\Y';
return new Y();
+ default:
+ throw new Exception('Invalid instance class given');
}
}
}
View
2  demo/Library.php
@@ -18,7 +18,7 @@ protected function doGetInstanceFor($type, array $parameters = array())
case 'library_B':
return new B($this->getInstanceFor('library_A'));
-// if this has to be a certain instance (not a type), call doGetInstanceFor instead of getInstenceFor
+// if this has to be a certain instance (not a type), call doGetInstanceFor instead of getInstanceFor
break;
default:
View
2  demo/demo.php
@@ -45,7 +45,7 @@
var_dump(get_class($factory->getInstanceFor('library_A')));
var_dump(get_class($factory->getInstanceFor('library_B')));
-// By printing the factory (or casting it to string), we get an overwiev
+// By printing the factory (or casting it to string), we get an overview
// of all registered child factories and the types they can create
print $factory;
View
8 src/MasterFactory.php
@@ -138,7 +138,7 @@ public function __toString()
return $result . PHP_EOL;
}
-
+
/**
* Adds a type and a reference to the factory that can instantiate this type
*
@@ -174,13 +174,13 @@ protected function getFactoryFor($type)
{
return $this->typeMap[$type];
}
-
+
/**
* Checks whether given factory is already registered
*
* @param ChildFactoryInterface $factory
* @return bool
- */
+ */
protected function isRegistered(ChildFactoryInterface $factory)
{
foreach (array_values($this->typeMap) as $f) {
@@ -188,7 +188,7 @@ protected function isRegistered(ChildFactoryInterface $factory)
return TRUE;
}
}
-
+
return FALSE;
}
}
View
2  tests/AbstractFactoryTest.php
@@ -58,7 +58,7 @@ protected function setUp()
{
$this->factory = new FactoryStub();
}
-
+
/**
* Destroys the test fixture.
*
View
8 tests/MasterFactoryTest.php
@@ -75,7 +75,7 @@ protected function setUp()
$this->factory = new MasterFactory();
$this->childFactory = $this->getMock('spriebsch\\factory\\ChildFactoryInterface');
}
-
+
/**
* Destroys the test fixture.
*
@@ -100,7 +100,7 @@ protected function setGetTypesExpectation()
}
/**
- * Makes sure that getTypes() initially returns an emtpy array
+ * Makes sure that getTypes() initially returns an empty array
*
* @covers spriebsch\factory\MasterFactory::getTypes
*/
@@ -120,7 +120,7 @@ public function testGetTypesReturnsArrayOfTypes()
{
$this->setGetTypesExpectation();
$this->factory->register($this->childFactory);
-
+
$this->secondChildFactory = $this->getMock('spriebsch\\factory\\ChildFactoryInterface');
$this->secondChildFactory->expects($this->once())
->method('getTypes')
@@ -245,7 +245,7 @@ public function testGetInstanceReturnsObjectInstance()
$this->assertSame($stub, $this->factory->getInstanceFor($this->type));
}
-
+
/**
* Makes sure that __toString() output contains master factory class name
*
Please sign in to comment.
Something went wrong with that request. Please try again.