Skip to content

Commit

Permalink
Rename interfaces, unset after unwrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
QWp6t authored and retlehs committed Mar 11, 2016
1 parent 9eaffa3 commit 97906e9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
6 changes: 3 additions & 3 deletions app/lib/Sage/Asset.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Roots\Sage;

use Roots\Sage\Assets\IManifest;
use Roots\Sage\Assets\ManifestInterface;

/**
* Class Template
Expand All @@ -11,14 +11,14 @@ class Asset {

public static $dist = '/dist';

/** @var IManifest Currently used manifest */
/** @var ManifestInterface Currently used manifest */
protected $manifest;

protected $asset;

protected $dir;

public function __construct($file, IManifest $manifest = null) {
public function __construct($file, ManifestInterface $manifest = null) {
$this->manifest = $manifest;
$this->asset = basename($file);
$this->dir = dirname($file) != '.' ? dirname($file) : '';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/Sage/Assets/JsonManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Roots\Sage
* @author QWp6t
*/
class JsonManifest implements IManifest {
class JsonManifest implements ManifestInterface {
/** @var array */
protected $manifest = [];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace Roots\Sage\Assets;

/**
* Interface IManifest
* Interface ManifestInterface
* @package Roots\Sage
* @author QWp6t
*/
interface IManifest {
interface ManifestInterface {

/**
* Get the cache-busted filename
Expand Down
12 changes: 7 additions & 5 deletions app/lib/Sage/Template.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Roots\Sage;

use Roots\Sage\Template\IWrapper;
use Roots\Sage\Template\WrapperInterface;

/**
* Class Template
Expand All @@ -10,7 +10,7 @@
class Template {
protected static $root = 'templates/';

/** @var IWrapper[] */
/** @var WrapperInterface[] */
protected static $wrappers = [];

protected $templates = [];
Expand All @@ -20,11 +20,11 @@ class Template {
protected $html = '';

/**
* @param IWrapper $wrapper
* @param WrapperInterface $wrapper
* @param array $context Variables to pass to wrapper
* @return static Template instance of wrapper
*/
public static function wrap(IWrapper $wrapper, $context = []) {
public static function wrap(WrapperInterface $wrapper, $context = []) {
self::$wrappers[$wrapper->getSlug()] = $wrapper;
return new static($wrapper->getWrappers(), $context);
}
Expand All @@ -40,7 +40,9 @@ public static function unwrap($slug = '', $context = []) {
end(self::$wrappers);
$slug = key(self::$wrappers);
}
return new static(self::$wrappers[$slug]->getTemplate(), $context);
$template = new static(self::$wrappers[$slug]->getTemplate(), $context);
unset(self::$wrappers[$slug]);
return $template;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/lib/Sage/Template/Wrapper.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace Roots\Sage\Template;

/**
* Interface Wrapper
* Class Wrapper
* @package Roots\Sage
* @author QWp6t
*/
class Wrapper implements IWrapper {
class Wrapper implements WrapperInterface {
/** @var string Wrapper slug */
protected $slug;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace Roots\Sage\Template;

/**
* Interface IWrapper
* Interface WrapperInterface
* @package Roots\Sage
* @author QWp6t
*/
interface IWrapper {
interface WrapperInterface {

/**
* Get a list of potential wrappers
Expand All @@ -21,7 +21,7 @@ public function getWrappers();
public function getTemplate();

/**
* @return string Slug of the Wrapper; e.g., `base`
* @return string Slug of the WrapperInterface; e.g., `base`
*/
public function getSlug();
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
]
},
"require": {
"php": ">=5.5.0",
"php": ">=5.4.0",
"composer/installers": "~1.0"
}
}

0 comments on commit 97906e9

Please sign in to comment.