Skip to content

Commit

Permalink
Merge pull request #2 from dotkernel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
n3vrax authored Jan 19, 2017
2 parents 79dfd90 + 78db15e commit eb164c1
Show file tree
Hide file tree
Showing 24 changed files with 196 additions and 203 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
}
],
"require": {

"php": "^5.6 || ^7.0",
"psr/http-message": "^1.0",
"container-interop/container-interop": "^1.1",
"zendframework/zend-expressive-helpers": "^2.0",
"zendframework/zend-expressive-template": "^1.0",
"zendframework/zend-servicemanager": "^3.1",
"zendframework/zend-escaper": "^2.5",
"zendframework/zend-stdlib": "^3.1"
"zendframework/zend-expressive-helpers": "^2.0",
"zendframework/zend-expressive-template": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"squizlabs/php_codesniffer": "^2.3",

"zendframework/zend-stdlib": "^3.1",
"dotkernel/dot-authorization": "0.6.x-dev"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ public function getDependencyConfig()
],
];
}
}
}
2 changes: 1 addition & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
interface ExceptionInterface
{

}
}
2 changes: 1 addition & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{

}
}
2 changes: 1 addition & 1 deletion src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
class RuntimeException extends \RuntimeException implements ExceptionInterface
{

}
}
2 changes: 1 addition & 1 deletion src/Factory/NavigationMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public function __invoke(ContainerInterface $container)
$navigation = $container->get(NavigationInterface::class);
return new NavigationMiddleware($navigation);
}
}
}
2 changes: 1 addition & 1 deletion src/Factory/NavigationOptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public function __invoke(ContainerInterface $container)
$config = $container->get('config')['dot_navigation'];
return new NavigationOptions($config);
}
}
}
3 changes: 1 addition & 2 deletions src/Factory/NavigationRendererFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ public function __invoke(ContainerInterface $container)
$template = $container->get(TemplateRendererInterface::class);

return new NavigationRenderer($navigation, $template, $options);

}
}
}
4 changes: 2 additions & 2 deletions src/Factory/NavigationServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __invoke(ContainerInterface $container)
$authorization = $container->has(AuthorizationInterface::class)
? $container->get(AuthorizationInterface::class)
: null;

$providerPluginManager = $container->get(ProviderPluginManager::class);

/** @var NavigationOptions $options */
Expand All @@ -43,4 +43,4 @@ public function __invoke(ContainerInterface $container)

return $service;
}
}
}
2 changes: 1 addition & 1 deletion src/Factory/ProviderPluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public function __invoke(ContainerInterface $container)
$config = $container->get('config')['dot_navigation']['provider_manager'];
return new ProviderPluginManager($container, $config);
}
}
}
4 changes: 1 addition & 3 deletions src/Filter/IsAllowedFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Dot\Navigation\Filter;


use Dot\Navigation\Service\NavigationInterface;

/**
Expand Down Expand Up @@ -49,5 +48,4 @@ public function getChildren()
$innerIterator = $this->getInnerIterator();
return new self($innerIterator->getChildren(), $this->navigation);
}

}
}
44 changes: 21 additions & 23 deletions src/NavigationContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Dot\Navigation;


/**
* Class Container
* @package Dot\Navigation
Expand Down Expand Up @@ -37,6 +36,26 @@ public function __construct(array $pages = [])
$this->addPages($pages);
}

/**
* @param array $pages
*/
public function addPages(array $pages)
{
foreach ($pages as $page) {
$this->addPage($page);
}
}

/**
* @param Page $page
* @return $this
*/
public function addPage(Page $page)
{
$this->children[] = $page;
return $this;
}

/**
* @return mixed
*/
Expand Down Expand Up @@ -93,26 +112,6 @@ public function getChildren()
return $this->children[$this->index];
}

/**
* @param array $pages
*/
public function addPages(array $pages)
{
foreach ($pages as $page) {
$this->addPage($page);
}
}

/**
* @param Page $page
* @return $this
*/
public function addPage(Page $page)
{
$this->children[] = $page;
return $this;
}

/**
* Find a single child by attribute
*
Expand Down Expand Up @@ -192,5 +191,4 @@ public function findByOption($option, $value)
}
return $result;
}

}
}
2 changes: 1 addition & 1 deletion src/NavigationMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res

return $next($request, $response);
}
}
}
4 changes: 1 addition & 3 deletions src/Options/MenuOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,4 @@ public function setUlClass($ulClass)
{
$this->ulClass = $ulClass;
}


}
}
4 changes: 1 addition & 3 deletions src/Options/NavigationOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,4 @@ public function setMenuOptions($menuOptions)

return $this;
}


}
}
52 changes: 26 additions & 26 deletions src/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ class Page extends NavigationContainer
*/
protected $parent;

/**
* @param Page $parent
*/
public function setParent(Page $parent)
{
$this->parent = $parent;
}

/**
* @return bool
*/
Expand All @@ -54,6 +46,14 @@ public function getParent()
return $this->parent;
}

/**
* @param Page $parent
*/
public function setParent(Page $parent)
{
$this->parent = $parent;
}

/**
* @param Page $page
* @return NavigationContainer
Expand All @@ -76,12 +76,11 @@ public function setOption($option, $value)
}

/**
* @param $option
* @return mixed|null
* @return array
*/
public function getOption($option)
public function getOptions()
{
return isset($this->options[$option]) ? $this->options[$option] : null;
return $this->options;
}

/**
Expand All @@ -94,14 +93,6 @@ public function setOptions(array $options)
return $this;
}

/**
* @return array
*/
public function getOptions()
{
return $this->options;
}

/**
* @param $attribute
* @param $value
Expand All @@ -122,6 +113,14 @@ public function getAttribute($attribute)
return isset($this->attributes[$attribute]) ? $this->attributes[$attribute] : null;
}

/**
* @return array
*/
public function getAttributes()
{
return $this->attributes;
}

/**
* @param array $attributes
* @return $this
Expand All @@ -133,18 +132,19 @@ public function setAttributes(array $attributes)
}

/**
* @return array
* @return mixed|null
*/
public function getAttributes()
public function getName()
{
return $this->attributes;
return $this->getOption('name');
}

/**
* @param $option
* @return mixed|null
*/
public function getName()
public function getOption($option)
{
return $this->getOption('name');
return isset($this->options[$option]) ? $this->options[$option] : null;
}
}
}
2 changes: 1 addition & 1 deletion src/Provider/ArrayProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ protected function getPage(array $spec)

return $page;
}
}
}
2 changes: 1 addition & 1 deletion src/Provider/ProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ interface ProviderInterface
* @return NavigationContainer
*/
public function getContainer();
}
}
2 changes: 1 addition & 1 deletion src/Provider/ProviderPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class ProviderPluginManager extends AbstractPluginManager
protected $factories = [
ArrayProvider::class => InvokableFactory::class,
];
}
}
Loading

0 comments on commit eb164c1

Please sign in to comment.