1. Go to this page and download the library: Download memio/model 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/ */
memio / model example snippets
/**
* @api
*/
public function doSomething(ValueObject $valueObject, int $type = self::TYPE_ONE, bool $option = true);
emio\Model\Argument;
use Memio\Model\Method;
use Memio\Model\Phpdoc\ApiTag;
use Memio\Model\Phpdoc\MethodPhpdoc;
use Memio\Model\Phpdoc\ParameterTag;
$method = (new Method('doSomething'))
->setPhpdoc((new MethodPhpdoc())
->addParameterTag(new ParameterTag('Vendor\Project\ValueObject', 'valueObject'))
->addParameterTag(new ParameterTag('int', 'type'))
->addParameterTag(new ParameterTag('bool', 'option'))
->addApiTag(new ApiTag())
)
->addArgument(new Argument('Vendor\Project\ValueObject', 'valueObject'))
->addArgument((new Argument('int', 'type'))
->setDefaultValue('self::TYPE_ONE')
)
->addArgument((new Argument('bool', 'option'))
->setDefaultValue('true')
)
;
// Let's say we've received the following two parameters:
$methodName = 'doSomething';
$arguments = [new \Vendor\Project\ValueObject(), ValueObject::TYPE_ONE, true];
$method = new Method($methodName);
$phpdoc = (new MethodPhpdoc())->setApiTag(new ApiTag());
$index = 1;
foreach ($arguments as $rawArgument) {
$type = is_object($rawArgument) ? get_class($argument) : gettype($rawArgument);
$name = 'argument'.$index++;
$argument = new Argument($type, $name);
$method->addArgument($argument);
$phpdoc->addParameterTag(new ParameterTag($type, $name));
}
$method->setPhpdoc($phpdoc);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.