From 87f1b945b5fc674b1d905d6a54b9e57a74056b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Cha=C5=82ubek?= Date: Tue, 4 Jul 2017 09:51:11 +0200 Subject: [PATCH 1/3] Add documentation link to the README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 439fb38..d28ac99 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ Some of features: - Readable and centralized Theme Configs - Enhanced [Templating](https://en.wikibooks.org/wiki/PHP_Programming/Why_Templating) with support for passing data +### Documentation + +Comprehensive documentation is available at http://labs.tonik.pl/theme/ + ## Contributing Great that you are considering supporting the project. You have a lot of ways to help us grow. We appreciate all contributions, even the smallest. @@ -23,4 +27,4 @@ Great that you are considering supporting the project. You have a lot of ways to ## License -Licensed under the [MIT license](http://opensource.org/licenses/MIT). \ No newline at end of file +Licensed under the [MIT license](http://opensource.org/licenses/MIT). From 1c62fcd5aece659e25d6a4c88de687b58fc1f165 Mon Sep 17 00:00:00 2001 From: jedrzejchalubek Date: Mon, 3 Jul 2017 15:02:48 +0200 Subject: [PATCH 2/3] Dump badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d28ac99..0664b28 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Tonik — Gin -[![Build Status](https://travis-ci.org/tonik/gin.svg?branch=develop)](https://travis-ci.org/tonik/gin) [![Coverage Status](https://coveralls.io/repos/github/tonik/gin/badge.svg?branch=develop)](https://coveralls.io/github/tonik/gin?branch=develop) +[![Build Status](https://travis-ci.org/tonik/gin.svg?branch=master)](https://travis-ci.org/tonik/gin) [![Coverage Status](https://coveralls.io/repos/github/tonik/gin/badge.svg?branch=master)](https://coveralls.io/github/tonik/gin?branch=master) ### Foundation of the [Tonik WordPress Starter Theme](https://github.com/tonik/tonik). Provides all custom functionalities which it offers. From 7932f6a385d553bfbe0d26e21df33e4bdea85480 Mon Sep 17 00:00:00 2001 From: jedrzejchalubek Date: Mon, 24 Jul 2017 14:52:07 +0200 Subject: [PATCH 3/3] Create an interface for Config component #6 --- src/Gin/Asset/Asset.php | 9 +++--- src/Gin/Contract/ConfigInterface.php | 42 ++++++++++++++++++++++++++++ src/Gin/Foundation/Autoloader.php | 8 +++--- src/Gin/Foundation/Config.php | 3 +- src/Gin/Foundation/Theme.php | 6 ++-- src/Gin/Template/Template.php | 13 ++++----- 6 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 src/Gin/Contract/ConfigInterface.php diff --git a/src/Gin/Asset/Asset.php b/src/Gin/Asset/Asset.php index 415f0f9..dd61d0b 100644 --- a/src/Gin/Asset/Asset.php +++ b/src/Gin/Asset/Asset.php @@ -2,16 +2,15 @@ namespace Tonik\Gin\Asset; -use Tonik\Gin\Foundation\Config; +use Tonik\Gin\Contract\ConfigInterface; use Tonik\Gin\Foundation\Exception\FileNotFoundException; -use Tonik\Gin\Foundation\Theme; class Asset { /** * Theme config instance. * - * @var \Tonik\Gin\Foundation\Config + * @var \Tonik\Gin\Foundation\ConfigInterface */ protected $config; @@ -25,9 +24,9 @@ class Asset /** * Construct asset. * - * @param \Tonik\Gin\Foundation\Config $config + * @param \Tonik\Gin\Foundation\ConfigInterface $config */ - public function __construct(Config $config) + public function __construct(ConfigInterface $config) { $this->config = $config; } diff --git a/src/Gin/Contract/ConfigInterface.php b/src/Gin/Contract/ConfigInterface.php new file mode 100644 index 0000000..9f8aba8 --- /dev/null +++ b/src/Gin/Contract/ConfigInterface.php @@ -0,0 +1,42 @@ +config = $config; } diff --git a/src/Gin/Foundation/Config.php b/src/Gin/Foundation/Config.php index 375fd70..1995eb9 100644 --- a/src/Gin/Foundation/Config.php +++ b/src/Gin/Foundation/Config.php @@ -3,8 +3,9 @@ namespace Tonik\Gin\Foundation; use ArrayAccess; +use Tonik\Gin\Contract\ConfigInterface; -class Config implements ArrayAccess +class Config implements ConfigInterface, ArrayAccess { /** * All of the configuration items. diff --git a/src/Gin/Foundation/Theme.php b/src/Gin/Foundation/Theme.php index 834979e..bbe3dc2 100644 --- a/src/Gin/Foundation/Theme.php +++ b/src/Gin/Foundation/Theme.php @@ -2,8 +2,8 @@ namespace Tonik\Gin\Foundation; -use Closure; use ArrayAccess; +use Closure; use Tonik\Gin\Foundation\Exception\BindingResolutionException; class Theme extends Singleton implements ArrayAccess @@ -92,7 +92,7 @@ public function get($key, array $parameters = []) if (isset($this->services[$key])) { // Resolve service jf we don't have // a deposit for this service. - if (! isset($this->deposit[$key])) { + if ( ! isset($this->deposit[$key])) { $this->deposit[$key] = $this->resolve($this->services[$key], $parameters); } @@ -148,7 +148,7 @@ public function offsetGet($key) */ public function offsetSet($key, $service) { - if (! is_callable($service)) { + if ( ! is_callable($service)) { throw new BindingResolutionException("Service definition [{$service}] is not an instance of Closure"); } diff --git a/src/Gin/Template/Template.php b/src/Gin/Template/Template.php index e6a5b13..fbc97e0 100644 --- a/src/Gin/Template/Template.php +++ b/src/Gin/Template/Template.php @@ -2,16 +2,15 @@ namespace Tonik\Gin\Template; -use Tonik\Gin\Foundation\Config; +use Tonik\Gin\Contract\ConfigInterface; use Tonik\Gin\Foundation\Exception\FileNotFoundException; -use Tonik\Gin\Foundation\Theme; class Template { /** * Theme config instance. * - * @var array + * @var \Tonik\Gin\Contract\ConfigInterface */ protected $config; @@ -25,9 +24,9 @@ class Template /** * Construct template. * - * @param \Tonik\Gin\Foundation\Config $config + * @param \Tonik\Gin\Contract\ConfigInterface $config */ - public function __construct(Config $config) + public function __construct(ConfigInterface $config) { $this->config = $config; } @@ -149,13 +148,13 @@ public function isNamed() { // If file is not array, then template // is not named for sure. - if (! is_array($this->file)) { + if ( ! is_array($this->file)) { return false; } // Return false if template is named, // but name is bool or null. - if (isset($this->file[1]) && is_bool($this->file[1]) || is_null($this->file[1])) { + if (isset($this->file[1]) && is_bool($this->file[1]) || null === $this->file[1]) { return false; }