public function setOldValues($object)
 {
     $properties = DocBlockParser::parseClass($object)->properties;
     if (isset($properties[$this->name])) {
         $this->_oldReadType = $properties[$this->name]['type'];
         $this->_oldReadComment = $properties[$this->name]['comment'];
     } else {
         $key = $this->name . '-write';
         if (isset($properties[$key])) {
             $this->_oldWriteType = $properties[$key]['type'];
             $this->_oldWriteComment = $properties[$key]['comment'];
         }
         $key = $this->name . '-read';
         if (isset($properties[$key])) {
             $this->_oldReadType = $properties[$key]['type'];
             $this->_oldReadComment = $properties[$key]['comment'];
         }
     }
 }
Example #2
0
 /**
  * @param $class
  * @param $object
  *
  * @return string final dockBlock
  */
 protected function getDockBlock($class, $object)
 {
     $props = $this->getPropertyIterator($object);
     $parser = DocBlockParser::parseClass($class);
     //add commets and stars :-)
     $result = "/** \n";
     foreach (explode("\n", $this->getRawDockBlock($parser, $props)) as $line) {
         $result .= " * " . trim($line) . PHP_EOL;
     }
     return $result . " */";
 }
 public function setOldValues($object)
 {
     parent::_setOldValues(DocBlockParser::parseClass($object)->methods);
 }
 /**
  * get users properties
  *
  * @return array
  */
 public function getUsers($object, $props)
 {
     //try to get or set all @property from current doc, for finding user writable properties
     $parser = DocBlockParser::parseClass(get_class($object));
     $tmp = array();
     foreach ($parser->properties as $prop => $data) {
         if (array_key_exists($prop, $props)) {
             continue;
         }
         try {
             $object->{$prop};
         } catch (Exception $e) {
             try {
                 $object->{$prop} = true;
             } catch (Exception $e) {
                 continue;
             }
         }
         $tmp[] = $prop;
     }
     $res = $this->instantAll($tmp, $this->propertyOptions);
     $tmp = array();
     foreach ($parser->methods as $method => $data) {
         if (array_key_exists($method, $props)) {
             continue;
         }
         try {
             $object->{$method}();
         } catch (Exception $e) {
             continue;
         }
         $tmp[] = $method;
     }
     $res = array_merge($res, $this->instantAll($tmp, $this->methodOptions));
     $this->addComment($res, 'users');
     return $res;
 }