Skip to content

Commit

Permalink
Run php-cs-fixer on classes and tests for code standards.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Wheeler committed May 21, 2015
1 parent 520ed89 commit 4693362
Show file tree
Hide file tree
Showing 72 changed files with 130 additions and 145 deletions.
2 changes: 0 additions & 2 deletions classes/OpenCFP/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
use OpenCFP\Provider\ControllerResolverServiceProvider;
use OpenCFP\Provider\Endpoints\RouteServiceProvider;
use Silex\Provider\FormServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\SessionServiceProvider;
use Silex\Provider\SwiftmailerServiceProvider;
use Silex\Provider\TranslationServiceProvider;
use Silex\Provider\UrlGeneratorServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Symfony\Component\HttpFoundation\Request;

class Application extends SilexApplication
{
Expand Down
2 changes: 1 addition & 1 deletion classes/OpenCFP/Application/NotAuthorizedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace OpenCFP\Application;

class NotAuthorizedException extends \Exception {}
class NotAuthorizedException extends \Exception {}
5 changes: 3 additions & 2 deletions classes/OpenCFP/Application/Speakers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use OpenCFP\Domain\Talk\TalkRepository;
use OpenCFP\Domain\Talk\TalkSubmission;
use OpenCFP\Domain\Talk\TalkWasSubmitted;
use OpenCFP\Domain\ValidationException;

class Speakers
{
Expand All @@ -31,7 +30,7 @@ class Speakers
/** @var EventDispatcher */
private $dispatcher;

function __construct(
public function __construct(
CallForProposal $callForProposal,
IdentityProvider $identityProvider,
SpeakerRepository $speakers,
Expand All @@ -53,6 +52,7 @@ function __construct(
public function findProfile()
{
$speaker = $this->identityProvider->getCurrentUser();

return new SpeakerProfile($speaker);
}

Expand Down Expand Up @@ -88,6 +88,7 @@ public function getTalk($talkId)
public function getTalks()
{
$speaker = $this->identityProvider->getCurrentUser();

return $speaker->talks->execute();
}

Expand Down
4 changes: 2 additions & 2 deletions classes/OpenCFP/Console/Application.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace OpenCFP\Console;
<?php namespace OpenCFP\Console;

use OpenCFP\Console\Command\ClearCacheCommand;
use Symfony\Component\Console\Application as ConsoleApplication;
Expand Down Expand Up @@ -36,4 +36,4 @@ public function getContainer()
{
return $this->app;
}
}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Console/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ protected function initialize(InputInterface $input, OutputInterface $output)
// Probably okay.
$this->app = $this->getApplication()->getContainer();
}
}
}
9 changes: 4 additions & 5 deletions classes/OpenCFP/Console/Command/AdminDemoteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ protected function configure()
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
public function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -62,13 +62,12 @@ public function execute(InputInterface $input, OutputInterface $output)
$adminGroup = $sentry->getGroupProvider()->findByName('Admin');
$user->removeGroup($adminGroup);
$output->writeln(sprintf(' Removed <info>%s</info> from the Admin group', $email));
}
catch (UserNotFoundException $e) {
} catch (UserNotFoundException $e) {
$output->writeln(sprintf('<error>Error:</error> Could not find user by %s', $email));
exit(1);
}

$output->writeln('Done!');
exit(0);
}
}
}
9 changes: 4 additions & 5 deletions classes/OpenCFP/Console/Command/AdminPromoteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ protected function configure()
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
public function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -63,13 +63,12 @@ public function execute(InputInterface $input, OutputInterface $output)
$adminGroup = $sentry->getGroupProvider()->findByName('Admin');
$user->addGroup($adminGroup);
$output->writeln(sprintf(' Added <info>%s</info> to the Admin group', $email));
}
catch (UserNotFoundException $e) {
} catch (UserNotFoundException $e) {
$output->writeln(sprintf('<error>Error:</error> Could not find user by %s', $email));
exit(1);
}

$output->writeln('Done!');
exit(0);
}
}
}
9 changes: 3 additions & 6 deletions classes/OpenCFP/Console/Command/ClearCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
namespace OpenCFP\Console\Command;

use Cartalyst\Sentry\Sentry;
use Cartalyst\Sentry\Users\UserNotFoundException;
use OpenCFP\Console\BaseCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class ClearCacheCommand extends BaseCommand
Expand All @@ -27,8 +24,8 @@ protected function configure()
/**
* Execute the command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return void
*/
public function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -45,4 +42,4 @@ public function execute(InputInterface $input, OutputInterface $output)

$output->writeln('Done!');
}
}
}
4 changes: 2 additions & 2 deletions classes/OpenCFP/ContainerAware.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace OpenCFP;
namespace OpenCFP;

trait ContainerAware
{
Expand All @@ -18,4 +18,4 @@ protected function service($slug)
{
return $this->app[$slug];
}
}
}
5 changes: 3 additions & 2 deletions classes/OpenCFP/Domain/CallForProposal.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class CallForProposal
*/
private $endDate;

public function __construct(DateTime $end){
public function __construct(DateTime $end)
{
$this->endDate = $end;
}

Expand All @@ -30,4 +31,4 @@ public function isOpen()

return $now < $this->endDate;
}
}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/EntityNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
class EntityNotFoundException extends \Exception
{

}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/Services/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ public function authenticate($username, $password);
*/
public function logout();

}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/Services/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
class EventDispatcher extends SymfonyEventDispatcher
{

}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/Services/IdentityProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ interface IdentityProvider
*/
public function getCurrentUser();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class NotAuthenticatedException extends \Exception
{
}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/Services/ProfileImageProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function process(UploadedFile $file, $publishFilename)

try {
$file->move($this->publishDir, $tempFilename);

$speakerPhoto = Image::make($this->publishDir . '/' . $tempFilename);

if ($speakerPhoto->height > $speakerPhoto->width) {
Expand Down
4 changes: 2 additions & 2 deletions classes/OpenCFP/Domain/Speaker/SpeakerProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SpeakerProfile
*/
protected $speaker;

function __construct($speaker)
public function __construct($speaker)
{
$this->speaker = $speaker;
}
Expand Down Expand Up @@ -97,4 +97,4 @@ public function toArrayForApi()
'bio' => $this->getBio()
];
}
}
}
8 changes: 4 additions & 4 deletions classes/OpenCFP/Domain/Speaker/SpeakerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ interface SpeakerRepository
/**
* Retrieves a speaker with associated talks.
*
* @param string $speakerId
* @param string $speakerId
* @throws EntityNotFoundException
* @return User the speaker that matches given identifier.
* @return User the speaker that matches given identifier.
*/
public function findById($speakerId);

/**
* Saves a speaker and their talks.
*
* @param User $speaker
* @param User $speaker
* @return mixed
*/
public function persist(User $speaker);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

class InvalidTalkSubmissionException extends ValidationException
{
}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/Talk/TalkRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ interface TalkRepository
* @return mixed
*/
public function persist(Talk $talk);
}
}
4 changes: 2 additions & 2 deletions classes/OpenCFP/Domain/Talk/TalkSubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function guardCategoryIsValid($data)
if (!isset($data['category']) or empty($data['category'])) {
throw new InvalidTalkSubmissionException('You must choose what category of talk you are submitting.');
}

if (!$this->isValidCategory($data['category'])) {
throw new InvalidTalkSubmissionException('You did not choose a valid talk category.');
}
Expand All @@ -131,4 +131,4 @@ private function isValidCategory($category)
]);
}

}
}
4 changes: 2 additions & 2 deletions classes/OpenCFP/Domain/Talk/TalkWasSubmitted.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace OpenCFP\Domain\Talk;
namespace OpenCFP\Domain\Talk;

use OpenCFP\Domain\Entity\Talk;
use Symfony\Component\EventDispatcher\Event;
Expand All @@ -19,4 +19,4 @@ public function getTalk()
{
return $this->talk;
}
}
}
2 changes: 1 addition & 1 deletion classes/OpenCFP/Domain/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

class ValidationException extends \Exception
{
}
}
7 changes: 4 additions & 3 deletions classes/OpenCFP/Http/API/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace OpenCFP\Http\API;

use OpenCFP\Application;
use OpenCFP\ContainerAware;
use Symfony\Component\HttpFoundation\JsonResponse as Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class ApiController
class ApiController
{

use ContainerAware;
Expand All @@ -22,6 +21,7 @@ class ApiController
public function setStatusCode($status)
{
$this->statusCode = $status;

return $this;
}

Expand Down Expand Up @@ -107,6 +107,7 @@ public function respondWithError($message)
E_USER_WARNING
);
}

return $this->respond([
'message' => $message,
]);
Expand Down Expand Up @@ -135,4 +136,4 @@ public function redirectTo($route, $status = 302)
{
return $this->app->redirect($this->url($route), $status);
}
}
}
5 changes: 1 addition & 4 deletions classes/OpenCFP/Http/API/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
use Exception;
use OpenCFP\Application\Speakers;
use OpenCFP\Domain\Services\NotAuthenticatedException;
use OpenCFP\Domain\Talk\InvalidTalkSubmissionException;
use OpenCFP\Domain\Talk\TalkSubmission;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class ProfileController extends ApiController
{
Expand Down Expand Up @@ -40,4 +37,4 @@ public function handleShowSpeakerProfile(Request $request)
return $this->respondInternalError($e->getMessage());
}
}
}
}
4 changes: 2 additions & 2 deletions classes/OpenCFP/Http/API/TalkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function handleViewAllTalks(Request $request)
// TODO Replace this crap with an object responsible for
// the "Talk Resource" to/from json.
$output = [];
foreach($talks as $talk) {
foreach ($talks as $talk) {
$output[] = $talk->toArrayForApi();
}

Expand All @@ -83,4 +83,4 @@ public function handleViewTalk(Request $request, $id)
return $this->respondUnauthorized();
}
}
}
}
Loading

0 comments on commit 4693362

Please sign in to comment.