@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | ['Lousy Coffee', '10', 'CZK'] |
| 18 | 18 | ]; |
| 19 | 19 | |
| 20 | -foreach($transactions as $transaction) {
|
|
| 20 | +foreach ($transactions as $transaction) {
|
|
| 21 | 21 | $parameters = array( |
| 22 | 22 | ':product' => $transaction[0], |
| 23 | 23 | ':price' => $transaction[1], |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | {
|
| 84 | 84 | public function fromString(string $fieldName, array $fields) |
| 85 | 85 | {
|
| 86 | - return new Currency($fields[$fieldName], $fields[$fieldName . '_currency']); |
|
| 86 | + return new Currency($fields[$fieldName], $fields[$fieldName.'_currency']); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $entityMapper = new \Agares\MicroORM\EntityMapper($typeMappers); |
| 98 | 98 | $queryAdapter = new \Agares\MicroORM\QueryAdapter($databaseAdapter, $entityMapper); |
| 99 | 99 | $transactions = $queryAdapter->executeQuery('SELECT product, price, price_currency FROM transactions', $entityDefinitionCreator->create(Transaction::class));
|
| 100 | -foreach($transactions as $transaction) {
|
|
| 100 | +foreach ($transactions as $transaction) {
|
|
| 101 | 101 | /** @var Transaction $transaction */ |
| 102 | - printf('%s (%s)%s', $transaction->getProduct(), (string)$transaction->getPrice(), PHP_EOL);
|
|
| 102 | + printf('%s (%s)%s', $transaction->getProduct(), (string) $transaction->getPrice(), PHP_EOL);
|
|
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | $methods = $entityReflection->getMethods(\ReflectionMethod::IS_PUBLIC); |
| 13 | 13 | |
| 14 | 14 | $entityDefinition = new EntityDefinition($className); |
| 15 | - foreach($methods as $method) {
|
|
| 15 | + foreach ($methods as $method) {
|
|
| 16 | 16 | $methodName = $method->getName(); |
| 17 | 17 | |
| 18 | - if(strpos($methodName, 'get') !== 0) {
|
|
| 18 | + if (strpos($methodName, 'get') !== 0) {
|
|
| 19 | 19 | continue; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $fieldName = lcfirst(substr($methodName, 3)); |
| 23 | - $fieldType = $method->getReturnType() === NULL ? 'string' : (string)$method->getReturnType(); |
|
| 23 | + $fieldType = $method->getReturnType() === NULL ? 'string' : (string) $method->getReturnType(); |
|
| 24 | 24 | |
| 25 | 25 | $entityDefinition->addField(new EntityFieldDefinition($fieldName, $fieldType)); |
| 26 | 26 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | namespace Agares\MicroORM; |
| 4 | 4 | |
| 5 | 5 | use Agares\MicroORM\TypeMappers\IntegerTypeMapper; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __construct(array $typeMappers = null) |
| 14 | 14 | {
|
| 15 | - if($typeMappers == null) {
|
|
| 15 | + if ($typeMappers == null) {
|
|
| 16 | 16 | $typeMappers = [ |
| 17 | 17 | 'string' => new StringTypeMapper(), |
| 18 | 18 | 'int' => new IntegerTypeMapper() |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | foreach ($fieldsDefinition as $fieldName => $definition) {
|
| 59 | 59 | $typeName = $definition->getTypeName(); |
| 60 | 60 | |
| 61 | - if(!isset($this->typeMappers[$typeName])) {
|
|
| 61 | + if (!isset($this->typeMappers[$typeName])) {
|
|
| 62 | 62 | throw new UnknownFieldTypeException($typeName); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function fromString(string $fieldName, array $fields) |
| 14 | 14 | {
|
| 15 | - return (int)$fields[$fieldName]; |
|
| 15 | + return (int) $fields[$fieldName]; |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |