-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace Zenstruck\ScheduleBundle\Schedule\Task; | ||
|
||
/** | ||
* @author Kevin Bond <kevinbond@gmail.com> | ||
*/ | ||
final class Config | ||
{ | ||
private $data = []; | ||
|
||
/** | ||
* @param mixed $value | ||
*/ | ||
public function set(string $name, $value): self | ||
{ | ||
$this->data[$name] = $value; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @param mixed $default | ||
* | ||
* @return mixed | ||
*/ | ||
public function get(string $name, $default = null) | ||
{ | ||
return $this->data[$name] ?? $default; | ||
} | ||
|
||
public function all(): array | ||
{ | ||
return $this->data; | ||
} | ||
|
||
public function humanized(): array | ||
{ | ||
$ret = []; | ||
|
||
foreach ($this->data as $key => $value) { | ||
switch (true) { | ||
case \is_bool($value): | ||
$value = $value ? 'yes' : 'no'; | ||
|
||
break; | ||
|
||
case \is_scalar($value): | ||
break; | ||
|
||
case \is_object($value): | ||
$value = \sprintf('(%s)', \get_class($value)); | ||
|
||
break; | ||
|
||
default: | ||
$value = \sprintf('(%s)', \gettype($value)); | ||
} | ||
|
||
$ret[$key] = $value; | ||
} | ||
|
||
return $ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.