Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>2019-12-30 18:13:46 +0300
committerScrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>2019-12-30 18:13:46 +0300
commitdf953c6bd707ecc0e887ae2c4034be537d8bfa60 (patch)
tree4169d2deade6b2ed35aceb797e4dccc26a39028e /tests
parent766fd8cc08e56b0d4968a6959bc2fd0ec99df44d (diff)
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/FactoryMuffin.php50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/Unit/FactoryMuffin.php b/tests/Unit/FactoryMuffin.php
index a8fb7d59..50e92c7f 100644
--- a/tests/Unit/FactoryMuffin.php
+++ b/tests/Unit/FactoryMuffin.php
@@ -7,30 +7,30 @@ use OCP\AppFramework\Db\Entity;
class FactoryMuffin extends OriginalFactoryMuffin
{
- /**
- * Generate and set the model attributes.
- * NOTE: Patch the original method to support dynamic setter and getter
- * of the OCP\AppFramework\Db\Entity class
- *
- * @param object $model The model instance.
- * @param array $attr The model attributes.
- *
- * @return void
- */
- protected function generate($model, array $attr = [])
- {
- foreach ($attr as $key => $kind) {
- $value = $this->factory->generate($kind, $model, $this);
+ /**
+ * Generate and set the model attributes.
+ * NOTE: Patch the original method to support dynamic setter and getter
+ * of the OCP\AppFramework\Db\Entity class
+ *
+ * @param object $model The model instance.
+ * @param array $attr The model attributes.
+ *
+ * @return void
+ */
+ protected function generate($model, array $attr = [])
+ {
+ foreach ($attr as $key => $kind) {
+ $value = $this->factory->generate($kind, $model, $this);
- $setter = 'set'.ucfirst(static::camelize($key));
- // check if there is a setter and use it instead
- if ($model instanceof Entity && is_callable([$model, $setter])) {
- $model->$setter($value);
- } elseif (method_exists($model, $setter) && is_callable([$model, $setter])) {
- $model->$setter($value);
- } else {
- $model->$key = $value;
- }
- }
- }
+ $setter = 'set'.ucfirst(static::camelize($key));
+ // check if there is a setter and use it instead
+ if ($model instanceof Entity && is_callable([$model, $setter])) {
+ $model->$setter($value);
+ } elseif (method_exists($model, $setter) && is_callable([$model, $setter])) {
+ $model->$setter($value);
+ } else {
+ $model->$key = $value;
+ }
+ }
+ }
}