Skip to content

Commit

Permalink
Merge pull request #23 from tattersoftware/style
Browse files Browse the repository at this point in the history
Apply CodeIgniter Coding Standard
  • Loading branch information
MGatner authored Sep 13, 2021
2 parents b5bc386 + 6603252 commit bd86605
Show file tree
Hide file tree
Showing 23 changed files with 192 additions and 160 deletions.
40 changes: 21 additions & 19 deletions examples/Handlers.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
<?php namespace Config;
<?php

/***
namespace Config;

/*
*
* This file contains example values to alter default library behavior.
* Recommended usage:
* 1. Copy the file to app/Config/Handlers.php
* 2. Change any values
* 3. Remove any lines to fallback to defaults
*
***/
*/

class Handlers extends \Tatter\Handlers\Config\Handlers
{
/**
* Classes to ignore across all handlers.
*
* @var array<string>
*/
/**
* Classes to ignore across all handlers.
*
* @var array<string>
*/
public $ignoredClasses = [];

/**
* Paths to check during automatic discovery.
*
* @var array<string>
*/
/**
* Paths to check during automatic discovery.
*
* @var array<string>
*/
public $autoDiscover = [];

/**
* Number of seconds to cache discovered handlers.
* Null disables caching
*
* @var int|null
*/
/**
* Number of seconds to cache discovered handlers.
* Null disables caching
*
* @var int|null
*/
public $cacheDuration = DAY;
}
4 changes: 3 additions & 1 deletion src/BaseHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Tatter\Handlers;
<?php

namespace Tatter\Handlers;

use Tatter\Handlers\Interfaces\HandlerInterface;

Expand Down
6 changes: 5 additions & 1 deletion src/Commands/HandlersList.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Tatter\Handlers\Commands;
<?php

namespace Tatter\Handlers\Commands;

use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
Expand All @@ -20,6 +22,7 @@ public function run(array $params = [])
if (empty($handlers->getConfig()->autoDiscover))
{
CLI::write('No paths are set for automatic discovery. See the config file for Tatter\Handlers.', 'yellow');

return;
}

Expand All @@ -32,6 +35,7 @@ public function run(array $params = [])
if (! $classes = $handlers->all())
{
CLI::write('No handlers detected.', 'yellow');

continue;
}

Expand Down
6 changes: 5 additions & 1 deletion src/Commands/HandlersRegister.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Tatter\Handlers\Commands;
<?php

namespace Tatter\Handlers\Commands;

use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
Expand All @@ -20,6 +22,7 @@ public function run(array $params = [])
if (empty($handlers->getConfig()->autoDiscover))
{
CLI::write('No paths are set for automatic discovery. See the config file for Tatter\Handlers.', 'yellow');

return;
}

Expand All @@ -32,6 +35,7 @@ public function run(array $params = [])
if (! $classes = $handlers->all())
{
CLI::write('No new handlers registered.', 'yellow');

continue;
}

Expand Down
5 changes: 4 additions & 1 deletion src/Commands/HandlersReset.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Tatter\Handlers\Commands;
<?php

namespace Tatter\Handlers\Commands;

use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
Expand All @@ -20,6 +22,7 @@ public function run(array $params = [])
if (empty($handlers->getConfig()->autoDiscover))
{
CLI::write('No paths are set for automatic discovery. See the config file for Tatter\Handlers.', 'yellow');

return;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Config/Handlers.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace Tatter\Handlers\Config;
<?php

namespace Tatter\Handlers\Config;

use CodeIgniter\Config\BaseConfig;

Expand All @@ -22,7 +24,7 @@ class Handlers extends BaseConfig
* Number of seconds to cache discovered handlers.
* Null disables caching
*
* @var integer|null
* @var int|null
*/
public $cacheDuration = DAY;
}
14 changes: 5 additions & 9 deletions src/Config/Services.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<?php namespace Tatter\Handlers\Config;
<?php

namespace Tatter\Handlers\Config;

use CodeIgniter\Cache\CacheInterface;
use Config\Services as BaseServices;
use Tatter\Handlers\Handlers;
use Tatter\Handlers\Config\Handlers as HandlersConfig;
use Tatter\Handlers\Handlers;

class Services extends BaseServices
{
/**
* @param string $path
* @param HandlersConfig|null $config
* @param CacheInterface|null $cache
* @param boolean $getShared
*/
public static function handlers(string $path = '', HandlersConfig $config = null, CacheInterface $cache = null, bool $getShared = true)
public static function handlers(string $path = '', ?HandlersConfig $config = null, ?CacheInterface $cache = null, bool $getShared = true)
{
if ($getShared)
{
Expand Down
Loading

0 comments on commit bd86605

Please sign in to comment.