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

Commit

Permalink
Fix: Run phpcbf
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 3, 2014
1 parent a0bb8e6 commit 6db2082
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 70 deletions.
2 changes: 1 addition & 1 deletion config/application.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'ScnSocialAuth',
'EdpGithub',
'Application',
'User',
'User',
'EdpModuleLayouts',
'ZfModule',
'EdpMarkdown',
Expand Down
8 changes: 4 additions & 4 deletions config/autoload/zfcuser.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@
//'use_redirect_parameter_if_present' => true,

/**
* Sets the view template for the user login widget
*
* Default value: 'zfc-user/user/login.phtml'
* Sets the view template for the user login widget
*
* Default value: 'zfc-user/user/login.phtml'
* Accepted values: string path to a view script
*/
*/
//'user_login_widget_view_template' => 'zfc-user/user/login.phtml',

/**
Expand Down
2 changes: 1 addition & 1 deletion config/constants.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
define('COPY_MSG', '&copy; 2005 - 2012 by Zend Technologies Ltd. All rights reserved.');
define('COPY_MSG', '&copy; 2005 - 2012 by Zend Technologies Ltd. All rights reserved.');
2 changes: 0 additions & 2 deletions module/Application/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ public function getAutoloaderConfig()
),
);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function feedAction()
$entry = $feed->createEntry();
$entry->setTitle($module->getName());

if($module->getDescription() == '') {
if ($module->getDescription() == '') {
$moduleDescription = "No Description available";
} else {
$moduleDescription = $module->getDescription();
Expand All @@ -75,5 +75,4 @@ public function feedAction()

return $feedmodel;
}

}
6 changes: 3 additions & 3 deletions module/User/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function bootstrap(ModuleManager $moduleManager, ApplicationInterface $ap
$em = $app->getEventManager()->getSharedManager();
$sm = $app->getServiceManager();

$em->attach('ScnSocialAuth\Authentication\Adapter\HybridAuth','githubToLocalUser', function ($e) {
$em->attach('ScnSocialAuth\Authentication\Adapter\HybridAuth', 'githubToLocalUser', function ($e) {
$localUser = $e->getTarget();
$userProfile = $e->getParam('userProfile');
$nickname = substr(
Expand All @@ -28,12 +28,12 @@ public function bootstrap(ModuleManager $moduleManager, ApplicationInterface $ap
$hybridAuth = $sm->get('HybridAuth');
$adapter = $hybridAuth->getAdapter('github');

if($adapter->isUserConnected()) {
if ($adapter->isUserConnected()) {
$token = $adapter->getAccessToken();
$client = $e->getTarget();
$client->authenticate('url_token', $token['access_token']);
}
} );
});
}

public function getServiceConfig()
Expand Down
6 changes: 3 additions & 3 deletions module/User/src/User/Mapper/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

class User extends ZfcUserMapper
{
public function findAll($limit= null, $orderBy = null, $sort = 'ASC')
public function findAll($limit = null, $orderBy = null, $sort = 'ASC')
{
$sql = $this->getSql();
$select = $sql->select()
->from($this->tableName);

if($orderBy) {
if ($orderBy) {
$select->order($orderBy . ' ' . $sort);
}

if($limit) {
if ($limit) {
$select->limit($limit);
}

Expand Down
1 change: 0 additions & 1 deletion module/User/src/User/View/Helper/NewUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@ public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
$this->serviceLocator = $serviceLocator;
return $this;
}

}
14 changes: 7 additions & 7 deletions module/User/src/User/View/Helper/UserRepositories.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,32 @@ public function __invoke($options = array())
$repositories = array();

$ownerRepos = $client->api('current_user')->repos(array('type' =>'owner'));
foreach($ownerRepos as $repo) {
if(!$repo->fork) {
foreach ($ownerRepos as $repo) {
if (!$repo->fork) {
$repositories[] = $repo;
}
}

$memberRepos = $client->api('current_user')->repos(array('type' =>'member'));
foreach($memberRepos as $repo) {
foreach ($memberRepos as $repo) {
$repositories[] = $repo;
}

$mapper = $sl->get('application_module_mapper');
foreach($repositories as $key => $repo) {
if($repo->fork) {
foreach ($repositories as $key => $repo) {
if ($repo->fork) {
unset($repositories[$key]);
} else {
$module = $mapper->findByName($repo->name);
if($module) {
if ($module) {
unset($repositories[$key]);
} else {
$em = $client->getHttpClient()->getEventManager();
$errorListener = $sl->get('EdpGithub\Listener\Error');
$em->detachAggregate($errorListener);
$module = $client->api('repos')->content($repo->full_name, 'Module.php');
$response = $client->getHttpClient()->getResponse();
if(!$response->isSuccess()){
if (!$response->isSuccess()) {
unset($repositories[$key]);
}
$em->attachAggregate($errorListener);
Expand Down
2 changes: 1 addition & 1 deletion module/ZfModule/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getAutoloaderConfig()
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
// if we're in a namespace deeper than one level we need to fix the \ in the path
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/' , __NAMESPACE__),
__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/', __NAMESPACE__),
),
),
);
Expand Down
34 changes: 17 additions & 17 deletions module/ZfModule/src/ZfModule/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function viewAction()

//check if module is existing in database otherwise return 404 page
$result = $mapper->findByName($module);
if(!$result) {
if (!$result) {
$this->getResponse()->setStatusCode(404);
return;
}
Expand All @@ -34,28 +34,28 @@ public function viewAction()
$repository = json_decode($client->api('repos')->show($vendor, $module));
$httpClient = $client->getHttpClient();
$response= $httpClient->getResponse();
if($response->getStatusCode() == 304 && $cache->hasItem($cacheKey)) {
if ($response->getStatusCode() == 304 && $cache->hasItem($cacheKey)) {
return $cache->getItem($cacheKey);
}

$readme = $client->api('repos')->readme($vendor, $module);
$readme = json_decode($readme);
$repository = json_decode($client->api('repos')->show($vendor, $module));

try{
try {
$license = $client->api('repos')->content($vendor, $module, 'LICENSE');
$license = json_decode($license);
$license = base64_decode($license->content);
} catch(\Exception $e) {
} catch (\Exception $e) {
$license = 'No license file found for this Module';
}

try{
try {
$composerJson = $client->api('repos')->content($vendor, $module, 'composer.json');
$composerConf = json_decode($composerJson);
$composerConf = base64_decode($composerConf->content);
$composerConf = json_decode($composerConf, true);
} catch(\Exception $e) {
} catch (\Exception $e) {
$composerConf = 'No composer.json file found for this Module';
}

Expand All @@ -68,7 +68,7 @@ public function viewAction()
'license' => $license,
));

$cache->setItem($cacheKey , $viewModel);
$cache->setItem($cacheKey, $viewModel);

return $viewModel;
}
Expand Down Expand Up @@ -178,24 +178,24 @@ public function addAction()
}

$request = $this->getRequest();
if($request->isPost()) {
if ($request->isPost()) {
$repo = $request->getPost()->get('repo');
$owner = $request->getPost()->get('owner');

$sm = $this->getServiceLocator();
$repository = $sm->get('EdpGithub\Client')->api('repos')->show($owner, $repo);
$repository = json_decode($repository);

if(!($repository instanceof \stdClass)) {
if (!($repository instanceof \stdClass)) {
throw new Exception\RuntimeException(
'Not able to fetch the repository from github due to an unknown error.',
500
);
}

$service = $this->getModuleService();
if(!$repository->fork && $repository->permissions->push) {
if($service->isModule($repository)) {
if (!$repository->fork && $repository->permissions->push) {
if ($service->isModule($repository)) {
$module = $service->register($repository);
$this->flashMessenger()->addMessage($module->getName() .' has been added to ZF Modules');
} else {
Expand All @@ -204,7 +204,7 @@ public function addAction()
403
);
}
}else {
} else {
throw new Exception\UnexpectedValueException(
'You have no permission to add this module. The reason might be that you are' .
'neither the owner nor a collaborator of this repository.',
Expand Down Expand Up @@ -244,25 +244,25 @@ public function removeAction()
}

$request = $this->getRequest();
if($request->isPost()) {
if ($request->isPost()) {
$repo = $request->getPost()->get('repo');
$owner = $request->getPost()->get('owner');

$sm = $this->getServiceLocator();
$repository = $sm->get('EdpGithub\Client')->api('repos')->show($owner, $repo);
$repository = json_decode($repository);

if(!$repository instanceof \stdClass) {
if (!$repository instanceof \stdClass) {
throw new Exception\RuntimeException(
'Not able to fetch the repository from github due to an unknown error.',
500
);
}

if(!$repository->fork && $repository->permissions->push) {
if (!$repository->fork && $repository->permissions->push) {
$mapper = $sm->get('zfmodule_mapper_module');
$module = $mapper->findByUrl($repository->html_url);
if($module instanceof \ZfModule\Entity\Module) {
if ($module instanceof \ZfModule\Entity\Module) {
$module = $mapper->delete($module);
$this->flashMessenger()->addMessage($repository->name .' has been removed from ZF Modules');
} else {
Expand All @@ -271,7 +271,7 @@ public function removeAction()
403
);
}
}else {
} else {
throw new Exception\UnexpectedValueException(
'You have no permission to add this module. The reason might be that you are' .
'neither the owner nor a collaborator of this repository.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
use ZfcBase\Mapper\Exception\ExceptionInterface as Exception;

interface ExceptionInterface extends Exception
{}
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
namespace ZfModule\Mapper\Exception;

class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{}
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
namespace ZfModule\Mapper\Exception;

class RuntimeException extends \RuntimeException implements ExceptionInterface
{}
{

}
20 changes: 10 additions & 10 deletions module/ZfModule/src/ZfModule/Mapper/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public function pagination($page, $limit, $query = null, $orderBy = null, $sort
{
$select = $this->getSelect();

if($orderBy) {
if ($orderBy) {
$select->order($orderBy . ' ' . $sort);
}

if(null !== $query) {
if (null !== $query) {
$spec = function ($where) use ($query) {
$where->like('name', '%'.$query.'%')->or->like('description', '%'.$query.'%');
};
Expand All @@ -38,15 +38,15 @@ public function pagination($page, $limit, $query = null, $orderBy = null, $sort
return $paginator;
}

public function findAll($limit= null, $orderBy = null, $sort = 'ASC')
public function findAll($limit = null, $orderBy = null, $sort = 'ASC')
{
$select = $this->getSelect();

if($orderBy) {
if ($orderBy) {
$select->order($orderBy . ' ' . $sort);
}

if($limit) {
if ($limit) {
$select->limit($limit);
}

Expand All @@ -59,11 +59,11 @@ public function findByLike($query, $limit = null, $orderBy = null, $sort = 'ASC'
{
$select = $this->getSelect();

if($orderBy) {
if ($orderBy) {
$select->order($orderBy . ' ' . $sort);
}

if($limit) {
if ($limit) {
$select->limit($limit);
}

Expand All @@ -77,15 +77,15 @@ public function findByLike($query, $limit = null, $orderBy = null, $sort = 'ASC'
return $entity;
}

public function findByOwner($owner, $limit= null, $orderBy = null, $sort = 'ASC')
public function findByOwner($owner, $limit = null, $orderBy = null, $sort = 'ASC')
{
$select = $this->getSelect();

if($orderBy) {
if ($orderBy) {
$select->order($orderBy . ' ' . $sort);
}

if($limit) {
if ($limit) {
$select->limit($limit);
}

Expand Down
Loading

0 comments on commit 6db2082

Please sign in to comment.