Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fre5h authored Dec 4, 2017
1 parent 21d4205 commit 3d76bca
Show file tree
Hide file tree
Showing 53 changed files with 356 additions and 421 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Files and directories which won't be included in .zip archive during running `composer install --prefer-dist`

/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpunit.xml.dist export-ignore
/Tests export-ignore
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/vendor/
phpunit.xml
composer.lock
4 changes: 1 addition & 3 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
checks:
php:
code_rating: true
duplication: true
php: true

filter:
excluded_paths:
Expand Down
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1
- 7.1
- 7.2

env:
- SYMFONY_VERSION=2.8.*
- SYMFONY_VERSION=3.0.*
- SYMFONY_VERSION=3.1.*
- SYMFONY_VERSION=3.4.*

before_script:
before_install:
- composer self-update
- composer install --dev --prefer-dist --no-interaction
- composer require --no-update symfony/symfony "$SYMFONY_VERSION"

install:
- composer install --no-interaction --prefer-dist

script:
- ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=Tests --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony2
- ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore="vendor|Tests" --standard=./vendor/escapestudios/symfony2-coding-standard/Symfony
- ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml

after_success:
Expand Down
6 changes: 3 additions & 3 deletions Controller/SinchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -22,7 +22,7 @@
/**
* SinchController.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SinchController
{
Expand All @@ -47,7 +47,7 @@ public function __construct(FormFactory $formFactory, EventDispatcherInterface $
*
* @return Response
*/
public function callbackAction(Request $request)
public function callbackAction(Request $request): Response
{
try {
$callbackRequest = new CallbackRequest();
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,7 +16,7 @@
/**
* Configuration.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class Configuration implements ConfigurationInterface
{
Expand Down
12 changes: 2 additions & 10 deletions DependencyInjection/FreshSinchExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -18,7 +18,7 @@
/**
* FreshSinchExtension.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class FreshSinchExtension extends Extension
{
Expand All @@ -38,12 +38,4 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('sinch.secret', $config['secret']);
$container->setParameter('sinch.from', $config['from']);
}

/**
* {@inheritdoc}
*/
public function getAlias()
{
return 'fresh_sinch';
}
}
12 changes: 2 additions & 10 deletions Event/SinchEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,12 +13,10 @@
/**
* SinchEvents.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
final class SinchEvents
{
// region SMS sending

/**
* This event is triggered before the SMS is going to be sent.
*
Expand All @@ -33,16 +31,10 @@ final class SinchEvents
*/
const POST_SMS_SEND = 'sinch.sms.post_send';

// endregion

// region Callback

/**
* This event is triggered callback from Sinch is received.
*
* @see \Fresh\SinchBundle\Event\SmsMessageCallbackEvent Listeners receive an instance of this class
*/
const CALLBACK_RECEIVED = 'sinch.callback.received';

// endregion
}
18 changes: 9 additions & 9 deletions Event/SmsEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
/**
* SmsEvent.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SmsEvent extends Event
{
Expand All @@ -33,7 +33,7 @@ class SmsEvent extends Event
* @param string $message
* @param string|null $from
*/
public function __construct($number, $message, $from = null)
public function __construct(string $number, string $message, ?string $from = null)
{
$this->number = $number;
$this->message = $message;
Expand All @@ -43,7 +43,7 @@ public function __construct($number, $message, $from = null)
/**
* @return string
*/
public function getNumber()
public function getNumber(): string
{
return $this->number;
}
Expand All @@ -53,7 +53,7 @@ public function getNumber()
*
* @return $this
*/
public function setNumber($number)
public function setNumber(string $number): self
{
$this->number = $number;

Expand All @@ -63,7 +63,7 @@ public function setNumber($number)
/**
* @return string
*/
public function getMessage()
public function getMessage(): string
{
return $this->message;
}
Expand All @@ -73,7 +73,7 @@ public function getMessage()
*
* @return $this
*/
public function setMessage($message)
public function setMessage(string $message): self
{
$this->message = $message;

Expand All @@ -83,7 +83,7 @@ public function setMessage($message)
/**
* @return null|string
*/
public function getFrom()
public function getFrom(): ?string
{
return $this->from;
}
Expand All @@ -93,7 +93,7 @@ public function getFrom()
*
* @return $this
*/
public function setFrom($from)
public function setFrom(?string $from): self
{
$this->from = $from;

Expand Down
16 changes: 8 additions & 8 deletions Event/SmsMessageCallbackEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -17,7 +17,7 @@
/**
* SmsMessageCallbackEvent.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SmsMessageCallbackEvent extends Event
{
Expand All @@ -35,47 +35,47 @@ public function __construct(CallbackRequest $callbackRequest)
/**
* @return string
*/
public function getEvent()
public function getEvent(): string
{
return $this->callbackRequest->getEvent();
}

/**
* @return Identity
*/
public function getTo()
public function getTo(): Identity
{
return $this->callbackRequest->getTo();
}

/**
* @return Identity
*/
public function getFrom()
public function getFrom(): Identity
{
return $this->callbackRequest->getFrom();
}

/**
* @return string
*/
public function getMessage()
public function getMessage(): string
{
return $this->callbackRequest->getMessage();
}

/**
* @return \DateTime
*/
public function getTimestamp()
public function getTimestamp(): \DateTime
{
return $this->callbackRequest->getTimestamp();
}

/**
* @return int
*/
public function getVersion()
public function getVersion(): int
{
return $this->callbackRequest->getVersion();
}
Expand Down
4 changes: 2 additions & 2 deletions Exception/BadRequest/SinchInvalidRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
/**
* SinchInvalidRequestException.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SinchInvalidRequestException extends SinchException
{
Expand Down
4 changes: 2 additions & 2 deletions Exception/BadRequest/SinchMissingParameterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
/**
* SinchMissingParameterException.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SinchMissingParameterException extends SinchException
{
Expand Down
4 changes: 2 additions & 2 deletions Exception/BadRequest/SinchParameterValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
/**
* SinchParameterValidationException.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SinchParameterValidationException extends SinchException
{
Expand Down
4 changes: 2 additions & 2 deletions Exception/Forbidden/SinchForbiddenRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the FreshSinchBundle
*
* (c) Artem Genvald <genvaldartem@gmail.com>
* (c) Artem Henvald <genvaldartem@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,7 +15,7 @@
/**
* SinchForbiddenRequestException.
*
* @author Artem Genvald <genvaldartem@gmail.com>
* @author Artem Henvald <genvaldartem@gmail.com>
*/
class SinchForbiddenRequestException extends SinchException
{
Expand Down
Loading

0 comments on commit 3d76bca

Please sign in to comment.