Skip to content

Commit

Permalink
cs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 27, 2014
1 parent bdd7383 commit cdd9c03
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 56 deletions.
1 change: 0 additions & 1 deletion CmfCreateBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle;

use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
1 change: 0 additions & 1 deletion Command/InitHalloDevelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Command;

use Symfony\Component\Console\Command\Command;
Expand Down
9 changes: 3 additions & 6 deletions Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Composer;

use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\PhpExecutableFinder;

/**
* A hack to work around the missing support for js assets in composer
Expand Down Expand Up @@ -95,9 +92,9 @@ public static function downloadCkeditor($event)

/**
* @throws \RuntimeException
* @param string $directory The directory where the repository should be clone into
* @param string $repository The git repository
* @param string $commitId The commit id
* @param string $directory The directory where the repository should be clone into
* @param string $repository The git repository
* @param string $commitId The commit id
*/
public static function gitSynchronize($directory, $repository, $commitId)
{
Expand Down
14 changes: 7 additions & 7 deletions Controller/ImageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Controller;

use Doctrine\Common\Persistence\ManagerRegistry;
Expand All @@ -22,7 +21,6 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\SecurityContextInterface;

class ImageController extends FileController
{
Expand All @@ -41,7 +39,7 @@ class ImageController extends FileController
* @param string $managerName
* @param string $class FQN of image class
* @param string $rootPath Repository path where the
* images are located
* images are located
* @param MediaManagerInterface $mediaManager
* @param UploadFileHelperInterface $uploadFileHelper
* @param ViewHandlerInterface $viewHandler
Expand Down Expand Up @@ -84,6 +82,7 @@ private function processResults($images, $offset)
);

$view = View::create($data);

return $this->viewHandler->handle($view);
}

Expand All @@ -95,8 +94,8 @@ private function processResults($images, $offset)
*/
public function searchAction(Request $request)
{
$offset = (int)$request->query->get('offset', 0);
$limit = (int)$request->query->get('limit', 8);
$offset = (int) $request->query->get('offset', 0);
$limit = (int) $request->query->get('limit', 8);
$query = $request->query->get('query');
$images = $this->getImagesByCaption($query, $offset, $limit);

Expand All @@ -107,8 +106,8 @@ public function searchAction(Request $request)
* Get images by a specified caption
*
* @param string $name
* @param int $offset
* @param int $limit
* @param int $offset
* @param int $limit
*
* @return array
*/
Expand Down Expand Up @@ -136,6 +135,7 @@ public function showRelatedAction(Request $request)
);

$view = View::create($data);

return $this->viewHandler->handle($view);
}

Expand Down
20 changes: 9 additions & 11 deletions Controller/JsloaderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Controller;

use FOS\RestBundle\View\ViewHandlerInterface,
Expand Down Expand Up @@ -70,29 +69,28 @@ class JsloaderController
*/
private $browserFileHelper;


/**
* Create the Controller
*
* @param ViewHandlerInterface $viewHandler
* @param AccessCheckerInterface $accessChecker
* @param string $stanbolUrl the url to use for
* the semantic enhancer stanbol.
* the semantic enhancer stanbol.
* @param Boolean $imageUploadEnabled used to determine
* whether image upload should be activated.
* whether image upload should be activated.
* @param Boolean $fixedToolbar whether the toolbar
* is fixed or floating. Hallo editor specific.
* is fixed or floating. Hallo editor specific.
* @param array $plainTextTypes RDFa types to edit
* in raw text only.
* in raw text only.
* @param string|boolean $requiredRole Role a user needs to
* be granted in order to see the the editor. If set to false, the
* editor is always loaded.
* be granted in order to see the the editor. If set to false, the
* editor is always loaded.
* @param SecurityContextInterface $securityContext The security
* context to use to check for the role.
* context to use to check for the role.
* @param string $editorBasePath Configuration for
* ckeditor.
* ckeditor.
* @param BrowserFileHelper $browserFileHelper Used to determine
* image editing for ckeditor.
* image editing for ckeditor.
*/
public function __construct(
ViewHandlerInterface $viewHandler,
Expand Down
30 changes: 22 additions & 8 deletions Controller/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Controller;

use Symfony\Cmf\Bundle\CreateBundle\Security\AccessCheckerInterface;
Expand Down Expand Up @@ -92,7 +91,10 @@ protected function getModelBySubject(Request $request, $subject)
* @param Request $request
* @param string $subject URL of the subject, ie: cms/simple/news/news-name
*
* @return \Symfony\Component\HttpFoundation\Response
* @return Response
*
* @throws AccessDeniedException If the action is not allowed by the access
* checker.
*/
public function putDocumentAction(Request $request, $subject)
{
Expand All @@ -115,6 +117,9 @@ public function putDocumentAction(Request $request, $subject)
* @param Request $request
*
* @return Response
*
* @throws AccessDeniedException If the action is not allowed by the access
* checker.
*/
public function postDocumentAction(Request $request)
{
Expand All @@ -129,18 +134,23 @@ public function postDocumentAction(Request $request)

if (!is_null($result)) {
$view = View::create($result)->setFormat('json');

return $this->viewHandler->handle($view, $request);
}

return Response::create('The document could not be created', 500);
}

/**
* Handle document delete
* Handle document deletion.
*
* @param Request $request
* @param string $subject URL of the subject, ie: cms/simple/news/news-name
*
* @return Response
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param string $subject URL of the subject, ie: cms/simple/news/news-name
* @return \Symfony\Component\HttpFoundation\Response
* @throws AccessDeniedException If the action is not allowed by the access
* checker.
*/
public function deleteDocumentAction(Request $request, $subject)
{
Expand All @@ -158,11 +168,15 @@ public function deleteDocumentAction(Request $request, $subject)
}

/**
* Get available Workflows for a document
* Get available Workflows for a document.
*
* @param Request $request
* @param $subject
* @param string $subject
*
* @return Response
*
* @throws AccessDeniedException If getting workflows for this document is
* not allowed by the access checker.
*/
public function workflowsAction(Request $request, $subject)
{
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/CmfCreateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\DependencyInjection;

use Midgard\CreatePHP\RestService;
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down
4 changes: 1 addition & 3 deletions Security/AccessCheckerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Security;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContextInterface;

/**
* An access check for the create bundle controllers that can decide whether
Expand All @@ -26,7 +24,7 @@ interface AccessCheckerInterface
* exception.
*
* @param Request $request The request in question, to take into account if
* needed.
* needed.
*
* @return boolean true if access is granted, false otherwise
*/
Expand Down
1 change: 0 additions & 1 deletion Security/AlwaysAllowChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Security;
use Symfony\Component\HttpFoundation\Request;

Expand Down
18 changes: 10 additions & 8 deletions Security/RoleAccessChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Security;

use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -41,11 +40,14 @@ class RoleAccessChecker implements AccessCheckerInterface
protected $logger;

/**
* @param string $requiredRole The role to check
* with the securityContext.
* @param SecurityContextInterface|null $securityContext The security
* context to use to check for the role. If this is null, the security
* check will always return false.
* @param string $requiredRole The role to check with the security
* context.
* @param SecurityContextInterface|null $securityContext Context to get the current user from
* and check if he has the required role.
* If it is null, the security check will
* always return false.
* @param LoggerInterface $logger The logger to log exceptions from the
* security context.
*/
public function __construct(
$requiredRole,
Expand All @@ -70,9 +72,9 @@ public function check(Request $request)
&& $this->securityContext->getToken()
&& $this->securityContext->isGranted($this->requiredRole)
;
} catch(\Exception $e) {
} catch (\Exception $e) {
if ($this->logger) {
$this->logger->error($e);
$this->logger->error($e, array('exception' => $e));
}
// ignore and return false
}
Expand Down
1 change: 0 additions & 1 deletion Tests/Unit/Security/AlwaysAllowCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Tests\Unit\Security;

use Symfony\Cmf\Bundle\CreateBundle\Security\AlwaysAllowChecker;
Expand Down
1 change: 0 additions & 1 deletion Tests/Unit/Security/RoleAccessCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* file that was distributed with this source code.
*/


namespace Symfony\Cmf\Bundle\CreateBundle\Tests\Unit\Security;

use Symfony\Cmf\Bundle\CreateBundle\Security\RoleAccessChecker;
Expand Down
14 changes: 8 additions & 6 deletions Workflow/DoctrinePhpcrDeleteWorkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Symfony\Cmf\Bundle\CreateBundle\Workflow;


use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectManager;
use Midgard\CreatePHP\WorkflowInterface;
Expand All @@ -12,12 +11,13 @@
*
* Implement direct deletion of an object.
*
* @package Symfony\Cmf\Bundle\CreateBundle\Workflow
* @author Uwe Jäger <[email protected]>
*/
class DoctrinePhpcrDeleteWorkflow implements WorkflowInterface
{
/** @var ObjectManager */
/**
* @var ObjectManager
*/
protected $om;

public function __construct(ManagerRegistry $registry, $name = null)
Expand All @@ -32,7 +32,9 @@ public function __construct(ManagerRegistry $registry, $name = null)
* @see http://createjs.org/guide/#workflows
*
* @param mixed $object
* @return array|null array to return for this workflow, or null if workflow is not allowed
*
* @return array|null Array to return for this workflow, or null if
* workflow is not allowed.
*/
public function getToolbarConfig($object)
{
Expand All @@ -50,7 +52,7 @@ public function getToolbarConfig($object)
* Execute this workflow
*
* The object will only be set if there is a subject parameter in $_GET
* that can be found by the mapper tied to the RestService
* that can be found by the mapper tied to the RestService.
*
* @param mixed $object
*
Expand All @@ -62,4 +64,4 @@ public function run($object)
$this->om->flush();
}

}
}

0 comments on commit cdd9c03

Please sign in to comment.