Navigation Menu

Skip to content

Commit

Permalink
New PHP namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech committed Apr 18, 2018
1 parent 8b8e0f4 commit 9b3f35d
Show file tree
Hide file tree
Showing 35 changed files with 111 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .php_cs
@@ -1,7 +1,7 @@
<?php

$header = <<<'EOF'
This file is part of the Slack Secret Santa project.
This file is part of the Secret Santa project.
(c) JoliCode <coucou@jolicode.com>
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# Slack Secret Santa app
# Secret Santa app

Just go to https://secret-santa.team/ and have fun.

Expand Down
4 changes: 2 additions & 2 deletions bin/console
Expand Up @@ -2,15 +2,15 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Joli\SlackSecretSanta\Kernel;
use JoliCode\SecretSanta\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
Expand Down
6 changes: 3 additions & 3 deletions composer.json
@@ -1,5 +1,5 @@
{
"name": "jolicode/slack-secret-santa",
"name": "jolicode/secret-santa",
"license": "MIT",
"authors": [
{
Expand All @@ -9,12 +9,12 @@
],
"autoload": {
"psr-4": {
"Joli\\SlackSecretSanta\\": "src/"
"JoliCode\\SecretSanta\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Joli\\SlackSecretSanta\\Tests\\": "tests/"
"JoliCode\\SecretSanta\\Tests\\": "tests/"
}
},
"require": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions config/routes.yaml
@@ -1,31 +1,31 @@
homepage:
path: /
defaults: { _controller: Joli\SlackSecretSanta\Controller\ContentController:homepage }
defaults: { _controller: JoliCode\SecretSanta\Controller\ContentController:homepage }

hall_of_fame:
path: /hall-of-fame
defaults: { _controller: Joli\SlackSecretSanta\Controller\ContentController:hallOfFame }
defaults: { _controller: JoliCode\SecretSanta\Controller\ContentController:hallOfFame }

run:
path: /run/{application}
defaults: { _controller: Joli\SlackSecretSanta\Controller\SantaController:run }
defaults: { _controller: JoliCode\SecretSanta\Controller\SantaController:run }

finish:
path: /finish/{hash}
defaults: { _controller: Joli\SlackSecretSanta\Controller\SantaController:finish }
defaults: { _controller: JoliCode\SecretSanta\Controller\SantaController:finish }

retry:
path: /retry/{hash}
defaults: { _controller: Joli\SlackSecretSanta\Controller\SantaController:retry }
defaults: { _controller: JoliCode\SecretSanta\Controller\SantaController:retry }

spoil:
path: /spoil
defaults: { _controller: Joli\SlackSecretSanta\Controller\SantaController:spoil }
defaults: { _controller: JoliCode\SecretSanta\Controller\SantaController:spoil }

slack_authenticate:
path: /auth/slack
defaults: { _controller: Joli\SlackSecretSanta\Controller\SlackController:authenticate }
defaults: { _controller: JoliCode\SecretSanta\Controller\SlackController:authenticate }

discord_authenticate:
path: /auth/discord
defaults: { _controller: Joli\SlackSecretSanta\Controller\DiscordController:authenticate }
defaults: { _controller: JoliCode\SecretSanta\Controller\DiscordController:authenticate }
16 changes: 8 additions & 8 deletions config/services.yaml
Expand Up @@ -16,40 +16,40 @@ services:

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
Joli\SlackSecretSanta\:
JoliCode\SecretSanta\:
resource: '../src/*'
# you can exclude directories or files
# but if a service is unused, it's removed anyway
exclude: '../src/{Entity,Repository,Tests}'

# controllers are imported separately to make sure they're public
# and have a tag that allows actions to type-hint services
Joli\SlackSecretSanta\Controller\:
JoliCode\SecretSanta\Controller\:
resource: '../src/Controller'
public: true
tags: ['controller.service_arguments']

# add more services, or override services that need manual wiring
Joli\SlackSecretSanta\Controller\SantaController:
JoliCode\SecretSanta\Controller\SantaController:
public: true
arguments:
$applications:
- '@Joli\SlackSecretSanta\Application\SlackApplication'
- '@Joli\SlackSecretSanta\Application\DiscordApplication'
- '@JoliCode\SecretSanta\Application\SlackApplication'
- '@JoliCode\SecretSanta\Application\DiscordApplication'

Joli\SlackSecretSanta\Controller\SlackController:
JoliCode\SecretSanta\Controller\SlackController:
public: true
arguments:
$slackClientId: '%env(SLACK_CLIENT_ID)%'
$slackClientSecret: '%env(SLACK_CLIENT_SECRET)%'

Joli\SlackSecretSanta\Controller\DiscordController:
JoliCode\SecretSanta\Controller\DiscordController:
public: true
arguments:
$discordClientId: '%env(DISCORD_CLIENT_ID)%'
$discordClientSecret: '%env(DISCORD_CLIENT_SECRET)%'

Joli\SlackSecretSanta\Discord\DiscordService:
JoliCode\SecretSanta\Discord\DiscordService:
public: true
arguments:
$discordBotToken: '%env(DISCORD_BOT_TOKEN)%'
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Expand Up @@ -9,7 +9,7 @@
>
<php>
<ini name="error_reporting" value="-1" />
<env name="KERNEL_CLASS" value="Joli\SlackSecretSanta\Kernel" />
<env name="KERNEL_CLASS" value="JoliCode\SecretSanta\Kernel" />
<env name="APP_ENV" value="test" />
<env name="APP_DEBUG" value="1" />
<env name="APP_SECRET" value="s$cretf0rt3st" />
Expand Down
4 changes: 2 additions & 2 deletions public/index.php
@@ -1,15 +1,15 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Joli\SlackSecretSanta\Kernel;
use JoliCode\SecretSanta\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
Expand Down
8 changes: 4 additions & 4 deletions src/Application/ApplicationInterface.php
@@ -1,18 +1,18 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Application;
namespace JoliCode\SecretSanta\Application;

use Joli\SlackSecretSanta\SecretSanta;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\SecretSanta;
use JoliCode\SecretSanta\User;

interface ApplicationInterface
{
Expand Down
14 changes: 7 additions & 7 deletions src/Application/DiscordApplication.php
@@ -1,21 +1,21 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Application;
namespace JoliCode\SecretSanta\Application;

use Joli\SlackSecretSanta\Discord\DiscordService;
use Joli\SlackSecretSanta\Discord\MessageSender;
use Joli\SlackSecretSanta\Discord\UserExtractor;
use Joli\SlackSecretSanta\SecretSanta;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\Discord\DiscordService;
use JoliCode\SecretSanta\Discord\MessageSender;
use JoliCode\SecretSanta\Discord\UserExtractor;
use JoliCode\SecretSanta\SecretSanta;
use JoliCode\SecretSanta\User;
use League\OAuth2\Client\Token\AccessToken;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down
12 changes: 6 additions & 6 deletions src/Application/SlackApplication.php
@@ -1,20 +1,20 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Application;
namespace JoliCode\SecretSanta\Application;

use Joli\SlackSecretSanta\SecretSanta;
use Joli\SlackSecretSanta\Slack\MessageSender;
use Joli\SlackSecretSanta\Slack\UserExtractor;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\SecretSanta;
use JoliCode\SecretSanta\Slack\MessageSender;
use JoliCode\SecretSanta\Slack\UserExtractor;
use JoliCode\SecretSanta\User;
use League\OAuth2\Client\Token\AccessToken;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down
5 changes: 2 additions & 3 deletions src/Controller/ContentController.php
@@ -1,17 +1,16 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Controller;
namespace JoliCode\SecretSanta\Controller;

use AdamPaterson\OAuth2\Client\Provider\Slack;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

Expand Down
8 changes: 4 additions & 4 deletions src/Controller/DiscordController.php
@@ -1,18 +1,18 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Controller;
namespace JoliCode\SecretSanta\Controller;

use Joli\SlackSecretSanta\Application\DiscordApplication;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\Application\DiscordApplication;
use JoliCode\SecretSanta\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down
16 changes: 8 additions & 8 deletions src/Controller/SantaController.php
@@ -1,22 +1,22 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Controller;
namespace JoliCode\SecretSanta\Controller;

use Joli\SlackSecretSanta\Application\ApplicationInterface;
use Joli\SlackSecretSanta\MessageDispatcher;
use Joli\SlackSecretSanta\Rudolph;
use Joli\SlackSecretSanta\SecretSanta;
use Joli\SlackSecretSanta\Spoiler;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\Application\ApplicationInterface;
use JoliCode\SecretSanta\MessageDispatcher;
use JoliCode\SecretSanta\Rudolph;
use JoliCode\SecretSanta\SecretSanta;
use JoliCode\SecretSanta\Spoiler;
use JoliCode\SecretSanta\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/SlackController.php
@@ -1,22 +1,22 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Controller;
namespace JoliCode\SecretSanta\Controller;

use AdamPaterson\OAuth2\Client\Provider\Slack;
use CL\Slack\Payload\AuthTestPayload;
use CL\Slack\Payload\AuthTestPayloadResponse;
use CL\Slack\Transport\ApiClient;
use Joli\SlackSecretSanta\Application\SlackApplication;
use Joli\SlackSecretSanta\User;
use JoliCode\SecretSanta\Application\SlackApplication;
use JoliCode\SecretSanta\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down
4 changes: 2 additions & 2 deletions src/Discord/DiscordService.php
@@ -1,15 +1,15 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Discord;
namespace JoliCode\SecretSanta\Discord;

use RestCord\DiscordClient;
use RestCord\Model\Guild\Guild;
Expand Down
6 changes: 3 additions & 3 deletions src/Discord/MessageSender.php
@@ -1,17 +1,17 @@
<?php

/*
* This file is part of the Slack Secret Santa project.
* This file is part of the Secret Santa project.
*
* (c) JoliCode <coucou@jolicode.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Joli\SlackSecretSanta\Discord;
namespace JoliCode\SecretSanta\Discord;

use Joli\SlackSecretSanta\SecretSanta;
use JoliCode\SecretSanta\SecretSanta;

class MessageSender
{
Expand Down

0 comments on commit 9b3f35d

Please sign in to comment.