for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/******************************************************************************
* An implementation of dicto (scg.unibe.ch/dicto) in and for PHP.
*
* Copyright (c) 2016 Richard Klees <[email protected]>
* This software is licensed under The MIT License. You should have received
* a copy of the license along with the code.
*/
namespace Lechimp\Dicto\Graph\Predicate;
use Lechimp\Dicto\Graph\Predicate;
use Lechimp\Dicto\Graph\Entity;
/**
* A predicate that negates another predicate;
class _Not extends _Combined {
* @var Predicate
protected $predicate;
public function __construct(Predicate $predicate) {
$this->predicate = $predicate;
}
* @inheritdocs
public function _compile() {
$compiled = $this->predicate->compile();
return function(Entity $e) use ($compiled) {
return !$compiled($e);
};
public function compile_to_source(array &$custom_closures) {
return
$this->predicate->compile_to_source($custom_closures).
" \$value = !\$value;\n";
public function for_types(array $existing_types) {
// Can't really know what is in predicate, so this could match
// all types.
return $existing_types;