PHP code example of radebatz / property-info-extras
1. Go to this page and download the library: Download radebatz/property-info-extras 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/ */
radebatz / property-info-extras example snippets
use Radebatz\PropertyInfoExtras\Extractor\DocBlockCache;
use Radebatz\PropertyInfoExtras\Extractor\DocBlockMagicExtractor;
/**
* @method string getProString()
* @method void setProString(?string $proString)
*/
class MagicPopo {
protected $properties = [];
public function __call($method, $args)
{
$name = lcfirst(substr($method, 3));
if (0 == count($args)) {
if (0 === strpos($method, 'get')) {
return array_key_exists($name, $this->properties) ? $this->properties[$name] : null;
}
} elseif (1 == count($args)) {
if (0 === strpos($method, 'set')) {
$this->properties[$name] = $args[0];
return;
}
}
throw new \RuntimeException(sprintf('Invalid method on: %s: method: "%s"', get_class($this), $method));
}
}
$phpDocMagicExtractor = new DocBlockMagicExtractor(new DocBlockCache());
$properties = $phpDocMagicExtractor->getProperties(MagicPopo::class);
// ['proString']
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.