import axiom without dependency on symfony console
Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit

This commit is contained in:
2020-06-21 07:36:31 -04:00
parent 348d17cdd3
commit fb619dccbf
27 changed files with 2608 additions and 829 deletions

View File

@@ -0,0 +1,13 @@
<?php
namespace Enzyme\Axiom\Atoms;
interface AtomInterface
{
/**
* Get the underlying value associated with this atom.
*
* @return mixed
*/
public function getValue();
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Enzyme\Axiom\Atoms;
use Enzyme\Axiom\Exceptions\AtomException;
class IntegerAtom implements AtomInterface
{
protected $value;
public function __construct($value)
{
if ($this->isInvalidOrFloat($value)) {
throw new AtomException(get_class($this), $value);
}
$this->value = (int)$value;
}
protected function isInvalidOrFloat($value)
{
return is_numeric($value) === false || is_float($value) === true;
}
public function getValue()
{
return $this->value;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Enzyme\Axiom\Atoms;
use Enzyme\Axiom\Exceptions\AtomException;
class StringAtom implements AtomInterface
{
protected $value;
public function __construct($value)
{
if (is_string($value) === false) {
throw new AtomException(get_class($this), $value);
}
$this->value = $value;
}
public function getValue()
{
return $this->value;
}
}