1. Go to this page and download the library: Download maximecolin/satisfaction library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maximecolin / satisfaction example snippets
class Article
{
public $published = false;
public $publishedAt;
}
use Satisfaction\CompositeSpecification;
class PublishedArticle extends CompositeSpecification
{
public function isSatisfiedBy($article)
{
return $article->published === true && $article->publishedAt <= new \DateTime();
}
}
$specicification = new PublishedArticle();
if ($specification->isSatisfiedBy($article)) {
// Do something
}
// If both foo and bar are satified
if ((new FooSpecification())->andX(new BarSpecification())->isSatifiedBy($object)) {
// Do something
}
// If foo is satisfied or bar is not
if ((new FooSpecification())->orX((new BarSpecification())->not())->isSatifiedBy($object)) {
// Do something
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.