| Conditions | 3 |
| Paths | 3 |
| Total Lines | 48 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 9 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 49 | protected function fillResource() |
||
| 50 | { |
||
| 51 | $name = static::getParamFromRequest('name', $this->request); |
||
|
1 ignored issue
–
show
|
|||
| 52 | $name = $this->cleanup($name); |
||
|
1 ignored issue
–
show
|
|||
| 53 | $namespace = dirname($name); |
||
| 54 | $name = basename($name); |
||
|
1 ignored issue
–
show
|
|||
| 55 | $name = $this->defaultValidator('name', $name, false |
||
|
1 ignored issue
–
show
|
|||
| 56 | , ResourceDOInterface::NAME_REG_SYMBOLS, $this->config->get('staticus.clean_resource_name')); |
||
| 57 | $namespace = $this->defaultValidator('namespace', $namespace, true |
||
| 58 | , ResourceDOInterface::NAMESPACE_REG_SYMBOLS, $this->config->get('staticus.clean_resource_name')); |
||
| 59 | if (!$this->namespaceValidator($namespace)) { |
||
| 60 | |||
| 61 | return false; |
||
| 62 | } |
||
| 63 | $alt = static::getParamFromRequest('alt', $this->request); |
||
|
1 ignored issue
–
show
|
|||
| 64 | $alt = $this->cleanup($alt); |
||
|
1 ignored issue
–
show
|
|||
| 65 | $var = static::getParamFromRequest('var', $this->request); |
||
|
1 ignored issue
–
show
|
|||
| 66 | $var = $this->cleanup($var); |
||
|
1 ignored issue
–
show
|
|||
| 67 | $var = $this->defaultValidator('var', $var, true, '\w\d\-\._'); |
||
|
1 ignored issue
–
show
|
|||
| 68 | $v = (int)static::getParamFromRequest('v', $this->request); |
||
|
1 ignored issue
–
show
|
|||
| 69 | $author = static::getParamFromRequest('author', $this->request); |
||
| 70 | $author = $this->cleanup($author); |
||
| 71 | |||
| 72 | $dataDir = $this->config->get('staticus.data_dir'); |
||
| 73 | /** |
||
| 74 | * You shouldn't check 'recreate' and 'destroy' params here. |
||
| 75 | * @see \Staticus\Action\StaticMiddlewareAbstract::postAction |
||
| 76 | * @see \Staticus\Action\StaticMiddlewareAbstract::deleteAction |
||
| 77 | */ |
||
| 78 | $this->resourceDO |
||
| 79 | ->reset() |
||
| 80 | ->setBaseDirectory($dataDir) |
||
| 81 | ->setNamespace($namespace) |
||
| 82 | ->setName($name) |
||
| 83 | ->setNameAlternative($alt) |
||
| 84 | ->setVariant($var) |
||
| 85 | ->setVersion($v) |
||
| 86 | ->setAuthor($author); |
||
| 87 | if (!$this->resourceDO->getType()) { |
||
| 88 | $type = static::getParamFromRequest('type', $this->request); |
||
| 89 | $type = $this->cleanup($type); |
||
| 90 | $type = $this->defaultValidator('type', $type); |
||
| 91 | $this->resourceDO->setType($type); |
||
| 92 | } |
||
| 93 | $this->fillResourceSpecialFields(); |
||
| 94 | |||
| 95 | return true; |
||
| 96 | } |
||
| 97 | abstract protected function fillResourceSpecialFields(); |
||
| 171 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..