@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Aura\Sql\ConnectionLocator; |
| 6 | 6 | |
| 7 | -class MysqlCountyRepository implements CountyRepositoryInterface |
|
| 8 | -{ |
|
| 7 | +class MysqlCountyRepository implements CountyRepositoryInterface |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
| 11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
| 15 | 15 | */ |
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + {
|
|
| 18 | 18 | $this->connections = $connections; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getCountyList() |
|
| 22 | - { |
|
| 21 | + public function getCountyList() |
|
| 22 | + {
|
|
| 23 | 23 | $query = " |
| 24 | 24 | SELECT `county`.`name`, `county`.`alias`, COUNT(1) AS `count` |
| 25 | 25 | FROM `jpemeric_waterfall`.`county` |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Aura\Sql\ConnectionLocator; |
| 6 | 6 | |
| 7 | -class MysqlPeriodRepository implements PeriodRepositoryInterface |
|
| 8 | -{ |
|
| 7 | +class MysqlPeriodRepository implements PeriodRepositoryInterface |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
| 11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
| 15 | 15 | */ |
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + {
|
|
| 18 | 18 | $this->connections = $connections; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getPeriodList() |
|
| 22 | - { |
|
| 21 | + public function getPeriodList() |
|
| 22 | + {
|
|
| 23 | 23 | $query = " |
| 24 | 24 | SELECT `period`.`name`, `period`.`alias`, COUNT(1) AS `count` |
| 25 | 25 | FROM `jpemeric_waterfall`.`period` |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Aura\Sql\ConnectionLocator; |
| 6 | 6 | |
| 7 | -class MysqlCompanionRepository implements CompanionRepositoryInterface |
|
| 8 | -{ |
|
| 7 | +class MysqlCompanionRepository implements CompanionRepositoryInterface |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
| 11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
| 15 | 15 | */ |
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + {
|
|
| 18 | 18 | $this->connections = $connections; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getCompanionList() |
|
| 22 | - { |
|
| 21 | + public function getCompanionList() |
|
| 22 | + {
|
|
| 23 | 23 | $query = " |
| 24 | 24 | SELECT `companion`.`name`, `companion`.`alias`, COUNT(1) AS `count` |
| 25 | 25 | FROM `jpemeric_waterfall`.`companion` |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Aura\Sql\ConnectionLocator; |
| 6 | 6 | |
| 7 | -class MysqlWaterfallRepository implements WaterfallRepositoryInterface |
|
| 8 | -{ |
|
| 7 | +class MysqlWaterfallRepository implements WaterfallRepositoryInterface |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
| 11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
| 15 | 15 | */ |
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + {
|
|
| 18 | 18 | $this->connections = $connections; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getWaterfalls($limit = null, $offset = 0) |
|
| 22 | - { |
|
| 21 | + public function getWaterfalls($limit = null, $offset = 0) |
|
| 22 | + {
|
|
| 23 | 23 | $query = " |
| 24 | 24 | SELECT `waterfall`.`id`, `waterfall`.`name`, `waterfall`.`alias`, |
| 25 | 25 | `watercourse`.`name` AS `watercourse`, `watercourse`.`alias` AS `watercourse_alias` |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Aura\Sql\ConnectionLocator; |
| 6 | 6 | |
| 7 | -class MysqlLogRepository implements LogRepositoryInterface |
|
| 8 | -{ |
|
| 7 | +class MysqlLogRepository implements LogRepositoryInterface |
|
| 8 | +{
|
|
| 9 | 9 | |
| 10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
| 11 | 11 | protected $connections; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
| 15 | 15 | */ |
| 16 | - public function __construct(ConnectionLocator $connections) |
|
| 17 | - { |
|
| 16 | + public function __construct(ConnectionLocator $connections) |
|
| 17 | + {
|
|
| 18 | 18 | $this->connections = $connections; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getActiveLogs($limit = null, $offset = 0) |
|
| 22 | - { |
|
| 21 | + public function getActiveLogs($limit = null, $offset = 0) |
|
| 22 | + {
|
|
| 23 | 23 | $query = " |
| 24 | 24 | SELECT `id`, `title`, `alias`, `date`, `publish_date`, `introduction` |
| 25 | 25 | FROM `jpemeric_waterfall`.`log` |
@@ -5,13 +5,13 @@ discard block |
||
| 5 | 5 | ini_set('display_errors', 0); |
| 6 | 6 | |
| 7 | 7 | |
| 8 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
| 8 | +require_once __DIR__.'/vendor/autoload.php'; |
|
| 9 | 9 | |
| 10 | 10 | $container = new Pimple\Container(); |
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | // load the config for the application |
| 14 | -$config_path = __DIR__ . '/config.json'; |
|
| 14 | +$config_path = __DIR__.'/config.json'; |
|
| 15 | 15 | |
| 16 | 16 | $handle = @fopen($config_path, 'r'); |
| 17 | 17 | if ($handle === false) { |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // timezones are fun |
| 31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
| 32 | -$container['default_timezone'] = function ($c) { |
|
| 32 | +$container['default_timezone'] = function($c) { |
|
| 33 | 33 | return new DateTimeZone('America/Phoenix'); |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | // configure the db connections holder |
| 38 | 38 | $db_connections = new Aura\Sql\ConnectionLocator(); |
| 39 | -$db_connections->setDefault(function () use ($config) { |
|
| 39 | +$db_connections->setDefault(function() use ($config) { |
|
| 40 | 40 | $connection = $config->database->slave; |
| 41 | 41 | return new Aura\Sql\ExtendedPdo( |
| 42 | 42 | "mysql:host={$connection->host}", |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $connection->password |
| 45 | 45 | ); |
| 46 | 46 | }); |
| 47 | -$db_connections->setWrite('master', function () use ($config) { |
|
| 47 | +$db_connections->setWrite('master', function() use ($config) { |
|
| 48 | 48 | $connection = $config->database->master; |
| 49 | 49 | return new Aura\Sql\ExtendedPdo( |
| 50 | 50 | "mysql:host={$connection->host}", |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $connection->password |
| 53 | 53 | ); |
| 54 | 54 | }); |
| 55 | -$db_connections->setRead('slave', function () use ($config) { |
|
| 55 | +$db_connections->setRead('slave', function() use ($config) { |
|
| 56 | 56 | $connection = $config->database->slave; |
| 57 | 57 | $pdo = new Aura\Sql\ExtendedPdo( |
| 58 | 58 | "mysql:host={$connection->host}", |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | // configure the comment service connection |
| 73 | -$container['comment_service_api'] = function () use ($config) { |
|
| 73 | +$container['comment_service_api'] = function() use ($config) { |
|
| 74 | 74 | $configuration = (new Jacobemerick\CommentService\Configuration()) |
| 75 | 75 | ->setUsername($config->comments->user) |
| 76 | 76 | ->setPassword($config->comments->password) |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // setup mail handler |
| 87 | -$container['mail'] = $container->factory(function ($c) { |
|
| 87 | +$container['mail'] = $container->factory(function($c) { |
|
| 88 | 88 | return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
| 89 | 89 | }); |
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // setup the logger |
| 93 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
| 93 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
| 94 | 94 | $logger = new Monolog\Logger($name); |
| 95 | 95 | |
| 96 | - $logPath = __DIR__ . "/logs/{$name}.log"; |
|
| 96 | + $logPath = __DIR__."/logs/{$name}.log"; |
|
| 97 | 97 | $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
| 98 | 98 | // todo - make this more useful |
| 99 | 99 | // $streamHandler->setFormatter( |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | // sets up shutdown function to display profiler |
| 125 | -register_shutdown_function(function () use ($container) { |
|
| 125 | +register_shutdown_function(function() use ($container) { |
|
| 126 | 126 | if ( |
| 127 | 127 | !isset($_COOKIE['debugger']) || |
| 128 | 128 | $_COOKIE['debugger'] != 'display' |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | ->getRead() |
| 135 | 135 | ->getProfiler() |
| 136 | 136 | ->getProfiles(); |
| 137 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
| 137 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
| 138 | 138 | return $profile['function'] == 'perform'; |
| 139 | 139 | }); |
| 140 | - $dbProfiles = array_map(function ($profile) { |
|
| 140 | + $dbProfiles = array_map(function($profile) { |
|
| 141 | 141 | return [ |
| 142 | 142 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
| 143 | 143 | 'parameters' => $profile['bind_values'], |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | use Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository; |
| 9 | 9 | |
| 10 | -class CommentSubmitModule |
|
| 11 | -{ |
|
| 10 | +class CommentSubmitModule |
|
| 11 | +{
|
|
| 12 | 12 | |
| 13 | 13 | private $site; |
| 14 | 14 | private $path; |
| 15 | 15 | private $fullPath; |
| 16 | 16 | |
| 17 | - public function __construct($site, $path, $fullPath, $pageTitle) |
|
| 18 | - { |
|
| 17 | + public function __construct($site, $path, $fullPath, $pageTitle) |
|
| 18 | + {
|
|
| 19 | 19 | $this->site = $site; |
| 20 | 20 | $this->path = $path; |
| 21 | 21 | $this->fullPath = $fullPath; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function activate() |
|
| 25 | - { |
|
| 24 | + public function activate() |
|
| 25 | + {
|
|
| 26 | 26 | // todo why is this responsible for checking on valid calls |
| 27 | 27 | if (!Request::hasPost()) { |
| 28 | 28 | return false; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | $this->redirectToComment($commentId); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - private function checkValidation() |
|
| 48 | - { |
|
| 47 | + private function checkValidation() |
|
| 48 | + {
|
|
| 49 | 49 | $errors = array(); |
| 50 | 50 | if (!Validate::checkRequest('post', 'name', 'name')) { |
| 51 | 51 | $errors['name'] = 'You must include a valid name'; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | return $errors; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - private function save(array $data) |
|
| 73 | - { |
|
| 72 | + private function save(array $data) |
|
| 73 | + {
|
|
| 74 | 74 | $path = $_SERVER['REQUEST_URI']; |
| 75 | 75 | $path = explode('/', $path); |
| 76 | 76 | $path = array_filter($path); |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | return $response['id']; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - private function redirectToComment($commentId) |
|
| 111 | - { |
|
| 110 | + private function redirectToComment($commentId) |
|
| 111 | + {
|
|
| 112 | 112 | $url = ''; |
| 113 | 113 | $url .= $this->fullPath; |
| 114 | 114 | $url .= "#comment-{$commentId}"; |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | use Jacobemerick\CommentService\Api\DefaultApi; |
| 7 | 7 | use Jacobemerick\CommentService\Model\Comment; |
| 8 | 8 | |
| 9 | -class ServiceCommentRepository implements CommentRepositoryInterface |
|
| 10 | -{ |
|
| 9 | +class ServiceCommentRepository implements CommentRepositoryInterface |
|
| 10 | +{
|
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @var DefaultApi |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @param DefaultApi $api |
| 19 | 19 | */ |
| 20 | - public function __construct(DefaultApi $api) |
|
| 21 | - { |
|
| 20 | + public function __construct(DefaultApi $api) |
|
| 21 | + {
|
|
| 22 | 22 | $this->api = $api; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | * @return array |
| 28 | 28 | * @throws ApiException |
| 29 | 29 | */ |
| 30 | - public function createComment(array $comment) |
|
| 31 | - { |
|
| 30 | + public function createComment(array $comment) |
|
| 31 | + {
|
|
| 32 | 32 | $response = $this->api->createComment($comment); |
| 33 | 33 | return $this->deserializeComment($response); |
| 34 | 34 | } |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @return array |
| 39 | 39 | * @throws ApiException |
| 40 | 40 | */ |
| 41 | - public function getComment($commentId) |
|
| 42 | - { |
|
| 41 | + public function getComment($commentId) |
|
| 42 | + {
|
|
| 43 | 43 | $response = $this->api->getComment($commentId); |
| 44 | 44 | return $this->deserializeComment($response); |
| 45 | 45 | } |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | * @return array |
| 54 | 54 | * @throws ApiException |
| 55 | 55 | */ |
| 56 | - public function getComments($domain = null, $path = null, $page = null, $perPage = null, $order = null) |
|
| 57 | - { |
|
| 56 | + public function getComments($domain = null, $path = null, $page = null, $perPage = null, $order = null) |
|
| 57 | + {
|
|
| 58 | 58 | $response = (array) $this->api->getComments($page, $perPage, $order, $domain, $path); |
| 59 | 59 | return array_map([$this, 'deserializeComment'], $response); |
| 60 | 60 | } |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * @param Comment $comment |
| 64 | 64 | * @return array |
| 65 | 65 | */ |
| 66 | - protected function deserializeComment(Comment $comment) |
|
| 67 | - { |
|
| 66 | + protected function deserializeComment(Comment $comment) |
|
| 67 | + {
|
|
| 68 | 68 | return [ |
| 69 | 69 | 'id' => $comment->getId(), |
| 70 | 70 | 'commenter' => [ |