Ejemplo n.º 1
0
 public function __set($method, $value)
 {
     switch (strtolower($method)) {
         case 'file_get_contents':
             if ($value === false) {
                 $this->fopen = false;
             } else {
                 $this->stat = array('mode' => 33188);
                 $this->fopen = true;
                 $this->fread[1] = $value;
                 $this->fread[2] = false;
                 $this->fclose = true;
             }
             return $this;
         case 'file_put_contents':
             $this->stat = array('mode' => 33188);
             $this->fopen = true;
             $this->fwrite = $value;
             $this->fclose = true;
             return $this;
         default:
             $method = static::mapMethod($method);
             switch ($method) {
                 case 'dir_opendir':
                     $this->dir_closedir = true;
                     $this->dir_rewinddir = true;
                     $this->dir_readdir = false;
                     $this->url_stat = array('mode' => 16877);
                     break;
                 case 'dir_readdir':
                     if ($value instanceof self) {
                         $value = $value->getBasename();
                     }
                     break;
             }
             return parent::__set($method, $value);
     }
 }
Ejemplo n.º 2
0
 protected function checkMethod($method)
 {
     if ($this->mockClass !== null && $this->disableMethodChecking === false && in_array(strtolower($method), $this->mockMethods) === false) {
         if (in_array('__call', $this->mockMethods) === false) {
             throw new exceptions\logic('Method \'' . $this->getMockClass() . '::' . $method . '()\' does not exist');
         }
         if (isset($this->__call) === false) {
             $controller = $this;
             parent::__set('__call', function ($method, $arguments) use($controller) {
                 return $controller->invoke($method, $arguments);
             });
         }
     }
     return $this;
 }
Ejemplo n.º 3
0
 private function set__call()
 {
     $controller = $this;
     parent::__set('__call', function ($method, $arguments) use($controller) {
         return $controller->invoke($method, $arguments);
     });
     return $this;
 }