Skip to content
This repository has been archived by the owner on May 1, 2019. It is now read-only.

Commit

Permalink
fixed cs, added comments, reverted unrelated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Rieger committed Dec 11, 2014
1 parent f11b0b5 commit 2187b64
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 43 deletions.
11 changes: 5 additions & 6 deletions module/ZfModule/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@
),

'view_helpers' => array(
'factories' => array(
'listModule' => 'ZfModule\View\Helper\ListModuleFactory',
'newModule' => 'ZfModule\View\Helper\NewModuleFactory',
'totalModules' => 'ZfModule\View\Helper\TotalModulesFactory',
),
'invokables' => array(
'moduleView' => 'ZfModule\View\Helper\ModuleView',
'moduleDescription' => 'ZfModule\View\Helper\ModuleDescription',
'composerView' => 'ZfModule\View\Helper\ComposerView',
),
'factories' => array(
'listModule' => 'ZfModule\View\Helper\ListModuleFactory',
'newModule' => 'ZfModule\View\Helper\NewModuleFactory',
'totalModules' => 'ZfModule\View\Helper\TotalModulesFactory',

)
),
'zfmodule' => array(
/**
Expand Down
10 changes: 6 additions & 4 deletions module/ZfModule/src/ZfModule/Service/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@

class Module extends EventProvider
{
/** @var Mapper\Module */
/**
* @var Mapper\Module
*/
private $moduleMapper;

/** @var Client */
/**
* @var Client
*/
private $githubClient;

/**
* Constructor
*
* @param Mapper\Module $moduleMapper
* @param Client $githubClient
*/
Expand Down
10 changes: 4 additions & 6 deletions module/ZfModule/src/ZfModule/Service/ModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@
use EdpGithub\Client;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use ZfModule\Mapper\Module;
use ZfModule\Mapper;

class ModuleFactory implements FactoryInterface
{
/**
* Create Service Instance
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed|Module
* @return Module
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
/** @var ModuleMapper $moduleMapper */
/* @var Mapper\Module $moduleMapper */
$moduleMapper = $serviceLocator->get('zfmodule_mapper_module');

/** @var Client $githubClient */
/* @var Client $githubClient */
$githubClient = $serviceLocator->get('EdpGithub\Client');

return new Module($moduleMapper, $githubClient);
Expand Down
1 change: 1 addition & 0 deletions module/ZfModule/src/ZfModule/View/Helper/ComposerView.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace ZfModule\View\Helper;

use Zend\View\Helper\AbstractHelper;
Expand Down
20 changes: 10 additions & 10 deletions module/ZfModule/src/ZfModule/View/Helper/ListModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@

class ListModule extends AbstractHelper
{
/** @var Mapper\Module */
/**
* @var Mapper\Module
*/
private $moduleMapper;

/** @var Client */
/**
* @var Client
*/
private $githubClient;

/**
* Constructor
*
* @param Mapper\Module $moduleMapper
* @param Client $githubClient
*/
Expand All @@ -40,12 +42,10 @@ public function __invoke($options = null)

//limit modules to only user modules
if ($user) {
$repositories = $this->githubClient->api('current_user')->repos(
array(
'type' =>'all',
'per_page' => 100
)
);
$repositories = $this->githubClient->api('current_user')->repos([
'type' =>'all',
'per_page' => 100
]);

$modules = array();
foreach ($repositories as $repository) {
Expand Down
25 changes: 20 additions & 5 deletions module/ZfModule/src/ZfModule/View/Helper/ListModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@

namespace ZfModule\View\Helper;

use EdpGithub\Client;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\HelperPluginManager;
use ZfModule\Mapper;

class ListModuleFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
/**
* @param ServiceLocatorInterface $helperPluginManager
* @return ListModule
*/
public function createService(ServiceLocatorInterface $helperPluginManager)
{
$sm = $serviceLocator->getServiceLocator();
$moduleMapper = $sm->get('zfmodule_mapper_module');
$githubClient = $sm->get('EdpGithub\Client');
/* @var HelperPluginManager $helperPluginManager */
$serviceManager = $helperPluginManager->getServiceLocator();

return new ListModule($moduleMapper, $githubClient);
/* @var Mapper\Module $moduleMapper */
$moduleMapper = $serviceManager->get('zfmodule_mapper_module');

/* @var Client $githubClient */
$githubClient = $serviceManager->get('EdpGithub\Client');

return new ListModule(
$moduleMapper,
$githubClient
);
}
}
16 changes: 13 additions & 3 deletions module/ZfModule/src/ZfModule/View/Helper/NewModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

class NewModule extends AbstractHelper
{
/** @var Mapper\Module */
/**
* @var Mapper\Module
*/
private $moduleMapper;

/**
* Constructor
*
* @param Mapper\Module $moduleMapper
*/
public function __construct(Mapper\Module $moduleMapper)
Expand All @@ -40,4 +40,14 @@ public function __invoke($options = null)

return $this->getView()->render($vm);
}

/**
* @param string $viewTemplate
* @return NewModules
*/
public function setViewTemplate($viewTemplate)
{
$this->viewTemplate = $viewTemplate;
return $this;
}
}
15 changes: 12 additions & 3 deletions module/ZfModule/src/ZfModule/View/Helper/NewModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\HelperPluginManager;
use ZfModule\Mapper;

class NewModuleFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
/**
* @param ServiceLocatorInterface $helperPluginManager
* @return NewModule
*/
public function createService(ServiceLocatorInterface $helperPluginManager)
{
$sm = $serviceLocator->getServiceLocator();
$moduleMapper = $sm->get('zfmodule_mapper_module');
/* @var HelperPluginManager $helperPluginManager */
$serviceManager = $helperPluginManager->getServiceLocator();

/* @var Mapper\Module $moduleMapper */
$moduleMapper = $serviceManager->get('zfmodule_mapper_module');

return new NewModule($moduleMapper);
}
Expand Down
6 changes: 3 additions & 3 deletions module/ZfModule/src/ZfModule/View/Helper/TotalModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

class TotalModules extends AbstractHelper
{
/** @var Mapper\Module */
/**
* @var Mapper\Module
*/
private $moduleMapper;

/**
Expand All @@ -16,8 +18,6 @@ class TotalModules extends AbstractHelper
protected $total;

/**
* Constructor
*
* @param Mapper\Module $moduleMapper
*/
public function __construct(Mapper\Module $moduleMapper)
Expand Down
15 changes: 12 additions & 3 deletions module/ZfModule/src/ZfModule/View/Helper/TotalModulesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\HelperPluginManager;
use ZfModule\Mapper;

class TotalModulesFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
/**
* @param ServiceLocatorInterface $helperPluginManager
* @return TotalModules
*/
public function createService(ServiceLocatorInterface $helperPluginManager)
{
$sm = $serviceLocator->getServiceLocator();
$moduleMapper = $sm->get('zfmodule_mapper_module');
/* @var HelperPluginManager $helperPluginManager */
$serviceManager = $helperPluginManager->getServiceLocator();

/* @var Mapper\Module $moduleMapper */
$moduleMapper = $serviceManager->get('zfmodule_mapper_module');

return new TotalModules($moduleMapper);
}
Expand Down

0 comments on commit 2187b64

Please sign in to comment.