Skip to content

Commit

Permalink
Merge pull request #38 from holtkamp/patch-use-FieldFactoryInterface
Browse files Browse the repository at this point in the history
Introduce FieldFactoryInterface
  • Loading branch information
dragonmantank committed Mar 25, 2020
2 parents b55e1f8 + 1942ec1 commit 07ca402
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Cron/CronExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class CronExpression
private $cronParts;

/**
* @var FieldFactory CRON field factory
* @var FieldFactoryInterface CRON field factory
*/
private $fieldFactory;

Expand All @@ -65,11 +65,11 @@ class CronExpression
* `@weekly` - Run once a week, midnight on Sun - 0 0 * * 0
* `@daily` - Run once a day, midnight - 0 0 * * *
* `@hourly` - Run once an hour, first minute - 0 * * * *
* @param null|FieldFactory $fieldFactory Field factory to use
* @param null|FieldFactoryInterface $fieldFactory Field factory to use
*
* @return CronExpression
*/
public static function factory(string $expression, FieldFactory $fieldFactory = null): CronExpression
public static function factory(string $expression, FieldFactoryInterface $fieldFactory = null): CronExpression
{
$mappings = [
'@yearly' => '0 0 1 1 *',
Expand Down
2 changes: 1 addition & 1 deletion src/Cron/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @see http://en.wikipedia.org/wiki/Cron
*/
class FieldFactory
class FieldFactory implements FieldFactoryInterface
{
/**
* @var array Cache of instantiated fields
Expand Down
8 changes: 8 additions & 0 deletions src/Cron/FieldFactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace Cron;

interface FieldFactoryInterface
{
public function getField(int $position);
}

0 comments on commit 07ca402

Please sign in to comment.