Skip to content

Commit

Permalink
Updated Container.php, Renderer.php, and CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Feb 1, 2016
1 parent f0ae045 commit a902f8e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

All Notable changes to `Slytherin` will be documented in this file

## [0.4.1](https://github.com/rougin/slytherin/compare/v0.1.0...v0.4.1) 2016-01-15
## [0.4.1](https://github.com/rougin/slytherin/compare/v0.1.0...v0.4.1) 2016-02-01

### Added
- Implementations for packages [Auryn](https://github.com/rdlowrey/auryn), [FastRoute](https://github.com/nikic/FastRoute), [League\Container](http://container.thephpleague.com) and [Whoops](https://github.com/filp/whoops)
- Unit tests

### Removed
- Third party packages in `composer.json`
- `IoC` directory (will now require implementations in [Interop\Container](https://github.com/container-interop/container-interop))
### Changed
- Moved required packages to `require-dev` in `composer.json`

## [0.4.0](https://github.com/rougin/slytherin/compare/v0.3.0...v0.4.0) 2016-01-13

Expand Down
5 changes: 0 additions & 5 deletions src/IoC/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ private function resolve($class)
// (collection of ReflectionParameter instances)
$parameters = $constructor->getParameters();

// If there is a constructor, but no dependencies, our job is done.
if (count($parameters) === 0) {
return new $class;
}

// This is were we store the dependencies
$newParameters = [];

Expand Down
14 changes: 3 additions & 11 deletions src/Template/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public function render($template, array $data = [])
$file = $this->getTemplate("$template.php");

// Extracts the specific parameters to the template.
if ( ! empty($data)) {
extract($data);
}
extract($data);

ob_start();

Expand All @@ -67,8 +65,6 @@ public function render($template, array $data = [])
*/
private function getTemplate($template)
{
$result = '';

foreach ($this->directories as $directory) {
$location = new RecursiveDirectoryIterator(
$directory,
Expand All @@ -82,15 +78,11 @@ private function getTemplate($template)

foreach ($iterator as $path) {
if (strpos($path, $template) !== false) {
$result = $path;
return $path;
}
}
}

if ($result === '') {
throw new InvalidArgumentException('Template file not found.');
}

return $result;
throw new InvalidArgumentException('Template file not found.');
}
}

0 comments on commit a902f8e

Please sign in to comment.