Esempio n. 1
0
 /**
  * Declare a realistic domain: $disjunction->realdomName(arg1, arg2…).
  * About constants: use for example: $disjunction->const(true).
  *
  * @param   string  $name         Realistic domain name.
  * @param   array   $arguments    Arguments.
  * @return  \Hoa\Realdom\Disjunction
  * @throws  \Hoa\Realdom\Exception
  */
 public function __call($name, array $arguments)
 {
     $name = ucfirst(strtolower($name));
     if ('Const' === $name) {
         $handle = $arguments;
         Realdom::autoBoxing($handle);
         $handle = $handle[0];
         $arguments = [];
     } elseif ('Variable' === $name) {
         $handle = new Crate\Variable($arguments[0]);
     } else {
         if (Core\Consistency::isKeyword($name)) {
             $name = 'Realdom' . $name;
         }
         try {
             $handle = dnew('(Hoathis or Hoa)\\Realdom\\' . $name, $arguments);
         } catch (Exception $e) {
             throw $e;
         } catch (Core\Exception $e) {
             throw new Exception('Realistic domain %s() does not exist (or something ' . 'wrong happened).', 0, strtolower($name), $e);
         }
     }
     $this->offsetSet(null, $handle);
     return $this;
 }