Skip to content
Permalink
Browse files

Run PHPCS fixer

  • Loading branch information...
REBELinBLUE committed Aug 5, 2018
1 parent 2e7c99b commit d773f176130f7ccefe287fcf420d201efa4ec361
Showing with 94 additions and 110 deletions.
  1. +1 −1 Makefile
  2. +1 −1 app/Console/Commands/CreateUser.php
  3. +1 −0 app/Console/Kernel.php
  4. +4 −4 app/Exceptions/Handler.php
  5. +3 −3 app/Http/Controllers/Admin/ProjectController.php
  6. +2 −2 app/Http/Controllers/Auth/ResetPasswordController.php
  7. +3 −3 app/Http/Kernel.php
  8. +3 −5 app/Http/Middleware/IsAdmin.php
  9. +2 −2 app/Http/Middleware/TrustProxies.php
  10. +1 −1 app/Jobs/DeployProject/ScriptBuilder.php
  11. +15 −15 app/Policies/ProjectPolicy.php
  12. +4 −4 app/Project.php
  13. +1 −1 app/Providers/AppServiceProvider.php
  14. +4 −7 app/Providers/AuthServiceProvider.php
  15. +1 −1 app/Repositories/Contracts/ProjectRepositoryInterface.php
  16. +5 −8 app/Repositories/EloquentProjectRepository.php
  17. +5 −5 app/User.php
  18. +1 −1 config/session.php
  19. +1 −1 database/factories/UserFactory.php
  20. +2 −6 database/migrations/2018_06_12_162953_create_user_project_table.php
  21. +4 −8 database/migrations/2018_06_12_171807_add_user_admin_column.php
  22. +1 −1 resources/lang/en/projects.php
  23. +2 −2 resources/lang/en/users.php
  24. +2 −2 tests/Unit/Console/Commands/CreateUserTest.php
  25. +4 −4 tests/Unit/Jobs/DeployProject/ScriptBuilderTest.php
  26. +5 −5 tests/Unit/Notifications/Configurable/DeploymentFinishedTestCase.php
  27. +4 −4 tests/Unit/Notifications/Configurable/HeartbeatChangedTestCase.php
  28. +4 −4 tests/Unit/Notifications/Configurable/UrlChangedTestCase.php
  29. +2 −2 tests/Unit/Notifications/System/ChangeEmailTest.php
  30. +1 −1 tests/Unit/Notifications/System/NewAccountTest.php
  31. +3 −3 tests/Unit/Notifications/System/NewTestNotificationTest.php
  32. +2 −2 tests/Unit/Notifications/System/ResetPasswordTest.php
  33. +0 −1 tests/Unit/Services/Webhooks/GitlabTest.php
@@ -71,7 +71,7 @@ phpcs: ##@tests PHP Coding Standards (PSR-2)
@docker-compose exec php-fpm composer test:phpcs

fix: ##@tests PHP Coding Standards Fixer
@docker-compose exec php-fpm composer test:lint:fix
@docker-compose exec php-fpm composer test:phpcs:fix

phpdoc-check: ##@tests PHPDoc Checker
@docker-compose exec php-fpm composer test:phpdoc
@@ -90,7 +90,7 @@ public function handle(Dispatcher $dispatcher, Validation $validation)
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users,email',
'password' => 'required|min:6',
'is_admin' => 'required|min:0|max:1'
'is_admin' => 'required|min:0|max:1',
]);
if (!$validator->passes()) {
@@ -94,6 +94,7 @@ protected function schedule(Schedule $schedule)
->hourly()
->withoutOverlapping();
}
//
// /**
// * Register the commands for the application.
@@ -33,8 +33,8 @@ class Handler extends ExceptionHandler
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
*
* @return \Illuminate\Http\Response
*/
@@ -52,8 +52,8 @@ protected function unauthenticated($request, AuthenticationException $exception)
*
* @todo Remove this
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
*
* @return \Illuminate\Http\JsonResponse
*/
@@ -9,11 +9,11 @@
use REBELinBLUE\Deployer\Http\Controllers\Controller;
use REBELinBLUE\Deployer\Http\Controllers\Resources\ResourceController;
use REBELinBLUE\Deployer\Http\Requests\StoreProjectRequest;
use REBELinBLUE\Deployer\User;
use REBELinBLUE\Deployer\Repositories\Contracts\UserRepositoryInterface;
use REBELinBLUE\Deployer\Repositories\Contracts\GroupRepositoryInterface;
use REBELinBLUE\Deployer\Repositories\Contracts\ProjectRepositoryInterface;
use REBELinBLUE\Deployer\Repositories\Contracts\TemplateRepositoryInterface;
use REBELinBLUE\Deployer\Repositories\Contracts\UserRepositoryInterface;
use REBELinBLUE\Deployer\User;
use Symfony\Component\HttpFoundation\Response;
/**
@@ -61,7 +61,7 @@ public function index(
'templates' => $templateRepository->getAll(),
'groups' => $groupRepository->getAll(),
'projects' => $projects->toJson(),
'users' => $user->findNonAdminUsers()->toJson()
'users' => $user->findNonAdminUsers()->toJson(),
]);
}
@@ -33,8 +33,8 @@ public function __construct()
protected function rules()
{
return [
'token' => 'required',
'email' => 'required|email',
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:6',
];
}
@@ -2,7 +2,6 @@
namespace REBELinBLUE\Deployer\Http;
use REBELinBLUE\Deployer\Http\Middleware\TrustProxies;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
@@ -13,12 +12,13 @@
use Illuminate\View\Middleware\ShareErrorsFromSession;
use REBELinBLUE\Deployer\Http\Middleware\Authenticate;
use REBELinBLUE\Deployer\Http\Middleware\EncryptCookies;
use REBELinBLUE\Deployer\Http\Middleware\IsAdmin;
use REBELinBLUE\Deployer\Http\Middleware\Locale;
use REBELinBLUE\Deployer\Http\Middleware\RedirectIfAuthenticated;
use REBELinBLUE\Deployer\Http\Middleware\RefreshJsonWebToken;
use REBELinBLUE\Deployer\Http\Middleware\TrimStrings;
use REBELinBLUE\Deployer\Http\Middleware\TrustProxies;
use REBELinBLUE\Deployer\Http\Middleware\VerifyCsrfToken;
use REBELinBLUE\Deployer\Http\Middleware\IsAdmin;
/**
* Kernel class.
@@ -69,6 +69,6 @@ class Kernel extends HttpKernel
'guest' => RedirectIfAuthenticated::class,
'jwt' => RefreshJsonWebToken::class,
'throttle' => ThrottleRequests::class,
'isadmin' => IsAdmin::class
'isadmin' => IsAdmin::class,
];
}
@@ -6,11 +6,10 @@
use Illuminate\Contracts\Auth\Factory as AuthFactory;
/**
* IsAdmin Middleware
* IsAdmin Middleware.
*/
class IsAdmin
{
/**
* @var AuthFactory
*/
@@ -24,12 +23,11 @@ public function __construct(AuthFactory $auth)
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
@@ -2,11 +2,11 @@
namespace REBELinBLUE\Deployer\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;
/**
* Middleware to specify which proxies to trust
* Middleware to specify which proxies to trust.
*/
class TrustProxies extends Middleware
{
@@ -254,7 +254,7 @@ private function shareFileCommands($release_dir, $shared_dir, $project_dir)
return '';
}
$migration = '.deployer-migrated';
$migration = '.deployer-migrated';
$backup_dir = $shared_dir . '.backup';
$script = $this->parser->parseFile('deploy.MigrateShared', [
@@ -2,21 +2,21 @@
namespace REBELinBLUE\Deployer\Policies;
use REBELinBLUE\Deployer\User;
use REBELinBLUE\Deployer\Project;
use Illuminate\Auth\Access\HandlesAuthorization;
use REBELinBLUE\Deployer\Project;
use REBELinBLUE\Deployer\User;
/**
* Project policies
* Project policies.
*/
class ProjectPolicy
{
use HandlesAuthorization;
/**
* Global policy with any action allowed for admins
* @param User $user
* @param string $ability
* Global policy with any action allowed for admins.
* @param User $user
* @param string $ability
* @return bool
*/
public function before($user, $ability)
@@ -29,8 +29,8 @@ public function before($user, $ability)
/**
* Determine whether the user can view the project.
*
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @return mixed
*/
public function view(User $user, Project $project)
@@ -41,8 +41,8 @@ public function view(User $user, Project $project)
/**
* Determine whether the user can rollback the project.
*
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @return mixed
*/
public function rollback(User $user, Project $project)
@@ -53,7 +53,7 @@ public function rollback(User $user, Project $project)
/**
* Determine whether the user can create projects.
*
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\User $user
* @return mixed
*/
public function create(User $user)
@@ -64,8 +64,8 @@ public function create(User $user)
/**
* Determine whether the user can update the project.
*
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @return mixed
*/
public function update(User $user, Project $project)
@@ -76,8 +76,8 @@ public function update(User $user, Project $project)
/**
* Determine whether the user can delete the project.
*
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @param \REBELinBLUE\Deployer\User $user
* @param \REBELinBLUE\Deployer\Project $project
* @return mixed
*/
public function delete(User $user, Project $project)
@@ -431,10 +431,10 @@ public function refs()
}
/**
* Has many relationship for users.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
* Has many relationship for users.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function users()
{
return $this->belongsToMany(User::class)->withPivot('role');
@@ -7,9 +7,9 @@
use Clockwork\Support\Laravel\ClockworkServiceProvider;
use GrahamCampbell\HTMLMin\HTMLMinServiceProvider;
use GrahamCampbell\HTMLMin\Http\Middleware\MinifyMiddleware;
use Laracademy\Commands\MakeServiceProvider;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\ServiceProvider;
use Laracademy\Commands\MakeServiceProvider;
use Laravel\Dusk\DuskServiceProvider;
use Lubusin\Decomposer\Decomposer;
use REBELinBLUE\Deployer\Project;
@@ -2,14 +2,13 @@
namespace REBELinBLUE\Deployer\Providers;
use REBELinBLUE\Deployer\Project;
use REBELinBLUE\Deployer\Policies\ProjectPolicy;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use REBELinBLUE\Deployer\Policies\ProjectPolicy;
use REBELinBLUE\Deployer\Project;
/**
* Auth Service Provider
* Auth Service Provider.
*/
class AuthServiceProvider extends ServiceProvider
{
@@ -24,8 +23,6 @@ class AuthServiceProvider extends ServiceProvider
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
@@ -15,7 +15,7 @@ interface ProjectRepositoryInterface
public function getByHash($hash);
/**
* @param bool $with_user
* @param bool $with_user
*
* @return \Illuminate\Database\Eloquent\Collection
*/
@@ -33,8 +33,7 @@ public function __construct(Project $model)
public function getAll($with_users = false)
{
$projects = $this->model
->orderBy('name')
;
->orderBy('name');
if ($with_users === true) {
$projects = $projects->with('users');
@@ -66,7 +65,7 @@ public function create(array $fields)
// Finally we update the project members
$this->setProjectMembers([
'managers' => isset($fields['managers']) ? explode(',', $fields['managers']) : null,
'users' => isset($fields['users']) ? explode(',', $fields['users']) : null
'users' => isset($fields['users']) ? explode(',', $fields['users']) : null,
], $project);
if ($template) {
@@ -103,17 +102,15 @@ public function updateById(array $fields, $model_id)
// Finally we update the project members
$this->setProjectMembers([
'managers' => isset($fields['managers']) ? explode(',', $fields['managers']) : null,
'users' => isset($fields['users']) ? explode(',', $fields['users']) : null
'users' => isset($fields['users']) ? explode(',', $fields['users']) : null,
], $project);
return $project;
}
/**
* @param array $members
* @param array $members
* @param object Project $project
*
* @return null
*/
public function setProjectMembers(array $members, Project $project)
{
@@ -127,7 +124,7 @@ public function setProjectMembers(array $members, Project $project)
$u = trim($u);
// If user ID is invalid, skipping...
if (empty($u) || ! !is_int($u)) {
if (empty($u) || (bool) is_int($u)) {
continue;
}
@@ -95,17 +95,17 @@ public function sendPasswordResetNotification($token)
}
/**
* Has many relationship for projects.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
* Has many relationship for projects.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function projects()
{
return $this->belongsToMany(Project::class);
}
/**
* Is this user a super administrator
* Is this user a super administrator.
*
* @return bool
*/
@@ -29,7 +29,7 @@
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
@@ -12,6 +12,6 @@
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt(str_random(10)),
'remember_token' => str_random(10),
'is_admin' => 1
'is_admin' => 1,
];
});
Oops, something went wrong.

0 comments on commit d773f17

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.