-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
308 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.idea | ||
/vendor | ||
/temp | ||
/composer.lock | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
includes: | ||
- temp/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon | ||
- temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon | ||
- temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon | ||
- temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon | ||
|
||
parameters: | ||
ignoreErrors: | ||
- '#Variable property access on \$[a-zA-Z0-9_]+#' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="Heimkaup ruleset"> | ||
<rule ref="./vendor/ninjify/coding-standard/ruleset.xml"> | ||
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration"/> | ||
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment" /> | ||
<exclude name="SlevomatCodingStandard.Operators.DisallowIncrementAndDecrementOperators" /> | ||
</rule> | ||
<rule name="SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment" /> | ||
<rule ref="Generic.WhiteSpace.ScopeIndent"> | ||
<properties> | ||
<property name="indent" value="4"/> | ||
<property name="tabIndent" value="true"/> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"> | ||
<properties> | ||
<property name="allowFullyQualifiedGlobalClasses" value="true"/> | ||
<property name="tabIndent" value="true"/> | ||
</properties> | ||
</rule> | ||
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> | ||
<rule ref="Generic.Metrics.CyclomaticComplexity"> | ||
<properties> | ||
<property name="complexity" value="14" /> | ||
<property name="absoluteComplexity" value="14" /> | ||
</properties> | ||
</rule> | ||
<rule ref="Generic.Metrics.NestingLevel"> | ||
<properties> | ||
<property name="nestingLevel" value="3"/> | ||
<property name="absoluteNestingLevel" value="4"/> | ||
</properties> | ||
</rule> | ||
|
||
<!-- tests are named differently --> | ||
<rule ref="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps"> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
</rule> | ||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
</rule> | ||
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
</rule> | ||
<rule ref="Squiz.Classes.ClassFileName.NoMatch"> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
</rule> | ||
<rule ref="Generic.Files.LineLength"></rule> | ||
</ruleset> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php declare (strict_types = 1); | ||
|
||
namespace DodoIt\EntityGenerator\Entity; | ||
|
||
use ArrayAccess; | ||
use ArrayIterator; | ||
use Countable; | ||
use Exception; | ||
use IteratorAggregate; | ||
|
||
class Entity implements ArrayAccess, IteratorAggregate, Countable | ||
{ | ||
|
||
public const TABLE = null; | ||
|
||
/** @var mixed[] */ | ||
protected $data; | ||
|
||
/** @var mixed[] */ | ||
private $modifications = []; | ||
|
||
public function __construct(array $arr = []) | ||
{ | ||
$this->data = $arr; | ||
foreach ($arr as $k => $v) { | ||
$this->$k = $v; | ||
} | ||
} | ||
|
||
|
||
public function _getModifications(): array | ||
{ | ||
return $this->modifications; | ||
} | ||
|
||
|
||
public function tableName(): ?string | ||
{ | ||
return static::TABLE; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function count() | ||
{ | ||
return count($this->data); | ||
} | ||
|
||
|
||
public function toArray(): array | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* @return ArrayIterator | ||
*/ | ||
public function getIterator() | ||
{ | ||
return new ArrayIterator($this->data); | ||
} | ||
|
||
/** | ||
* @param string $nm | ||
* @param mixed $val | ||
* @return void | ||
*/ | ||
public function offsetSet($nm, $val) | ||
{ | ||
$this->data[$nm] = $val; | ||
$this->modifications[$nm] = $val; | ||
$this->$nm = $val; | ||
} | ||
|
||
|
||
/** | ||
* @param string $nm | ||
* @return void | ||
*/ | ||
public function offsetGet($nm) | ||
{ | ||
throw new Exception('You should never access entity as array'); | ||
} | ||
|
||
|
||
/** | ||
* @param string $nm | ||
* @return void | ||
*/ | ||
public function offsetExists($nm) | ||
{ | ||
throw new Exception('You should never access entity as array'); | ||
} | ||
|
||
|
||
/** | ||
* @param string $nm | ||
* @return void | ||
*/ | ||
public function offsetUnset($nm) | ||
{ | ||
throw new Exception('You should never access entity as array'); | ||
} | ||
|
||
} |
Oops, something went wrong.