* lib update
* static analyzer added * new tags * logger improvements
This commit is contained in:
parent
a49577dfad
commit
b1f6daf424
293
.phan/config.php
Normal file
293
.phan/config.php
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Phan\Issue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configuration file was automatically generated by 'phan --init --init-level=3'
|
||||||
|
*
|
||||||
|
* TODOs (added by 'phan --init'):
|
||||||
|
*
|
||||||
|
* - Go through this file and verify that there are no missing/unnecessary files/directories.
|
||||||
|
* (E.g. this only includes direct composer dependencies - You may have to manually add indirect composer dependencies to 'directory_list')
|
||||||
|
* - Look at 'plugins' and add or remove plugins if appropriate (see https://github.com/phan/phan/tree/master/.phan/plugins#plugins)
|
||||||
|
* - Add global suppressions for pre-existing issues to suppress_issue_types (https://github.com/phan/phan/wiki/Tutorial-for-Analyzing-a-Large-Sloppy-Code-Base)
|
||||||
|
*
|
||||||
|
* This configuration will be read and overlaid on top of the
|
||||||
|
* default configuration. Command line arguments will be applied
|
||||||
|
* after this file is read.
|
||||||
|
*
|
||||||
|
* @see src/Phan/Config.php
|
||||||
|
* See Config for all configurable options.
|
||||||
|
*
|
||||||
|
* A Note About Paths
|
||||||
|
* ==================
|
||||||
|
*
|
||||||
|
* Files referenced from this file should be defined as
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* Config::projectPath('relative_path/to/file')
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* where the relative path is relative to the root of the
|
||||||
|
* project which is defined as either the working directory
|
||||||
|
* of the phan executable or a path passed in via the CLI
|
||||||
|
* '-d' flag.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
|
||||||
|
// Supported values: '7.0', '7.1', '7.2', '7.3', null.
|
||||||
|
// If this is set to null,
|
||||||
|
// then Phan assumes the PHP version which is closest to the minor version
|
||||||
|
// of the php executable used to execute phan.
|
||||||
|
// Automatically inferred from composer.json requirement for "php" of "^7.1"
|
||||||
|
'target_php_version' => '7.1',
|
||||||
|
|
||||||
|
// If enabled, missing properties will be created when
|
||||||
|
// they are first seen. If false, we'll report an
|
||||||
|
// error message if there is an attempt to write
|
||||||
|
// to a class property that wasn't explicitly
|
||||||
|
// defined.
|
||||||
|
'allow_missing_properties' => false,
|
||||||
|
|
||||||
|
// If enabled, null can be cast as any type and any
|
||||||
|
// type can be cast to null. Setting this to true
|
||||||
|
// will cut down on false positives.
|
||||||
|
'null_casts_as_any_type' => false,
|
||||||
|
|
||||||
|
// If enabled, allow null to be cast as any array-like type.
|
||||||
|
// This is an incremental step in migrating away from null_casts_as_any_type.
|
||||||
|
// If null_casts_as_any_type is true, this has no effect.
|
||||||
|
'null_casts_as_array' => true,
|
||||||
|
|
||||||
|
// If enabled, allow any array-like type to be cast to null.
|
||||||
|
// This is an incremental step in migrating away from null_casts_as_any_type.
|
||||||
|
// If null_casts_as_any_type is true, this has no effect.
|
||||||
|
'array_casts_as_null' => true,
|
||||||
|
|
||||||
|
// If enabled, scalars (int, float, bool, string, null)
|
||||||
|
// are treated as if they can cast to each other.
|
||||||
|
// This does not affect checks of array keys. See scalar_array_key_cast.
|
||||||
|
'scalar_implicit_cast' => false,
|
||||||
|
|
||||||
|
// If enabled, any scalar array keys (int, string)
|
||||||
|
// are treated as if they can cast to each other.
|
||||||
|
// E.g. array<int,stdClass> can cast to array<string,stdClass> and vice versa.
|
||||||
|
// Normally, a scalar type such as int could only cast to/from int and mixed.
|
||||||
|
'scalar_array_key_cast' => true,
|
||||||
|
|
||||||
|
// If this has entries, scalars (int, float, bool, string, null)
|
||||||
|
// are allowed to perform the casts listed.
|
||||||
|
// E.g. ['int' => ['float', 'string'], 'float' => ['int'], 'string' => ['int'], 'null' => ['string']]
|
||||||
|
// allows casting null to a string, but not vice versa.
|
||||||
|
// (subset of scalar_implicit_cast)
|
||||||
|
'scalar_implicit_partial' => [],
|
||||||
|
|
||||||
|
// If true, seemingly undeclared variables in the global
|
||||||
|
// scope will be ignored. This is useful for projects
|
||||||
|
// with complicated cross-file globals that you have no
|
||||||
|
// hope of fixing.
|
||||||
|
'ignore_undeclared_variables_in_global_scope' => true,
|
||||||
|
|
||||||
|
// Set this to false to emit PhanUndeclaredFunction issues for internal functions that Phan has signatures for,
|
||||||
|
// but aren't available in the codebase, or the internal functions used to run phan
|
||||||
|
// (may lead to false positives if an extension isn't loaded)
|
||||||
|
// If this is true(default), then Phan will not warn.
|
||||||
|
'ignore_undeclared_functions_with_known_signatures' => true,
|
||||||
|
|
||||||
|
// Backwards Compatibility Checking. This is slow
|
||||||
|
// and expensive, but you should consider running
|
||||||
|
// it before upgrading your version of PHP to a
|
||||||
|
// new version that has backward compatibility
|
||||||
|
// breaks.
|
||||||
|
'backward_compatibility_checks' => false,
|
||||||
|
|
||||||
|
// If true, check to make sure the return type declared
|
||||||
|
// in the doc-block (if any) matches the return type
|
||||||
|
// declared in the method signature.
|
||||||
|
'check_docblock_signature_return_type_match' => false,
|
||||||
|
|
||||||
|
// (*Requires check_docblock_signature_param_type_match to be true*)
|
||||||
|
// If true, make narrowed types from phpdoc params override
|
||||||
|
// the real types from the signature, when real types exist.
|
||||||
|
// (E.g. allows specifying desired lists of subclasses,
|
||||||
|
// or to indicate a preference for non-nullable types over nullable types)
|
||||||
|
// Affects analysis of the body of the method and the param types passed in by callers.
|
||||||
|
'prefer_narrowed_phpdoc_param_type' => true,
|
||||||
|
|
||||||
|
// (*Requires check_docblock_signature_return_type_match to be true*)
|
||||||
|
// If true, make narrowed types from phpdoc returns override
|
||||||
|
// the real types from the signature, when real types exist.
|
||||||
|
// (E.g. allows specifying desired lists of subclasses,
|
||||||
|
// or to indicate a preference for non-nullable types over nullable types)
|
||||||
|
// Affects analysis of return statements in the body of the method and the return types passed in by callers.
|
||||||
|
'prefer_narrowed_phpdoc_return_type' => true,
|
||||||
|
|
||||||
|
// If enabled, check all methods that override a
|
||||||
|
// parent method to make sure its signature is
|
||||||
|
// compatible with the parent's. This check
|
||||||
|
// can add quite a bit of time to the analysis.
|
||||||
|
// This will also check if final methods are overridden, etc.
|
||||||
|
'analyze_signature_compatibility' => true,
|
||||||
|
|
||||||
|
// This setting maps case insensitive strings to union types.
|
||||||
|
// This is useful if a project uses phpdoc that differs from the phpdoc2 standard.
|
||||||
|
// If the corresponding value is the empty string, Phan will ignore that union type (E.g. can ignore 'the' in `@return the value`)
|
||||||
|
// If the corresponding value is not empty, Phan will act as though it saw the corresponding unionTypes(s) when the keys show up in a UnionType of @param, @return, @var, @property, etc.
|
||||||
|
//
|
||||||
|
// This matches the **entire string**, not parts of the string.
|
||||||
|
// (E.g. `@return the|null` will still look for a class with the name `the`, but `@return the` will be ignored with the below setting)
|
||||||
|
//
|
||||||
|
// (These are not aliases, this setting is ignored outside of doc comments).
|
||||||
|
// (Phan does not check if classes with these names exist)
|
||||||
|
//
|
||||||
|
// Example setting: ['unknown' => '', 'number' => 'int|float', 'char' => 'string', 'long' => 'int', 'the' => '']
|
||||||
|
'phpdoc_type_mapping' => [],
|
||||||
|
|
||||||
|
// Set to true in order to attempt to detect dead
|
||||||
|
// (unreferenced) code. Keep in mind that the
|
||||||
|
// results will only be a guess given that classes,
|
||||||
|
// properties, constants and methods can be referenced
|
||||||
|
// as variables (like `$class->$property` or
|
||||||
|
// `$class->$method()`) in ways that we're unable
|
||||||
|
// to make sense of.
|
||||||
|
'dead_code_detection' => false,
|
||||||
|
|
||||||
|
// Set to true in order to attempt to detect unused variables.
|
||||||
|
// dead_code_detection will also enable unused variable detection.
|
||||||
|
// This has a few known false positives, e.g. for loops or branches.
|
||||||
|
'unused_variable_detection' => false,
|
||||||
|
|
||||||
|
// If true, this run a quick version of checks that takes less
|
||||||
|
// time at the cost of not running as thorough
|
||||||
|
// an analysis. You should consider setting this
|
||||||
|
// to true only when you wish you had more **undiagnosed** issues
|
||||||
|
// to fix in your code base.
|
||||||
|
//
|
||||||
|
// In quick-mode the scanner doesn't rescan a function
|
||||||
|
// or a method's code block every time a call is seen.
|
||||||
|
// This means that the problem here won't be detected:
|
||||||
|
//
|
||||||
|
// ```php
|
||||||
|
// <?php
|
||||||
|
// function test($arg):int {
|
||||||
|
// return $arg;
|
||||||
|
// }
|
||||||
|
// test("abc");
|
||||||
|
// ```
|
||||||
|
//
|
||||||
|
// This would normally generate:
|
||||||
|
//
|
||||||
|
// ```sh
|
||||||
|
// test.php:3 TypeError return string but `test()` is declared to return int
|
||||||
|
// ```
|
||||||
|
//
|
||||||
|
// The initial scan of the function's code block has no
|
||||||
|
// type information for `$arg`. It isn't until we see
|
||||||
|
// the call and rescan test()'s code block that we can
|
||||||
|
// detect that it is actually returning the passed in
|
||||||
|
// `string` instead of an `int` as declared.
|
||||||
|
'quick_mode' => false,
|
||||||
|
|
||||||
|
// If true, then before analysis, try to simplify AST into a form
|
||||||
|
// which improves Phan's type inference in edge cases.
|
||||||
|
//
|
||||||
|
// This may conflict with 'dead_code_detection'.
|
||||||
|
// When this is true, this slows down analysis slightly.
|
||||||
|
//
|
||||||
|
// E.g. rewrites `if ($a = value() && $a > 0) {...}`
|
||||||
|
// into $a = value(); if ($a) { if ($a > 0) {...}}`
|
||||||
|
'simplify_ast' => true,
|
||||||
|
|
||||||
|
// Enable or disable support for generic templated
|
||||||
|
// class types.
|
||||||
|
'generic_types_enabled' => true,
|
||||||
|
|
||||||
|
// Override to hardcode existence and types of (non-builtin) globals in the global scope.
|
||||||
|
// Class names should be prefixed with '\\'.
|
||||||
|
// (E.g. ['_FOO' => '\\FooClass', 'page' => '\\PageClass', 'userId' => 'int'])
|
||||||
|
'globals_type_map' => [],
|
||||||
|
|
||||||
|
// The minimum severity level to report on. This can be
|
||||||
|
// set to Issue::SEVERITY_LOW, Issue::SEVERITY_NORMAL or
|
||||||
|
// Issue::SEVERITY_CRITICAL. Setting it to only
|
||||||
|
// critical issues is a good place to start on a big
|
||||||
|
// sloppy mature code base.
|
||||||
|
'minimum_severity' => Issue::SEVERITY_LOW,
|
||||||
|
|
||||||
|
// Add any issue types (such as 'PhanUndeclaredMethod')
|
||||||
|
// to this black-list to inhibit them from being reported.
|
||||||
|
'suppress_issue_types' => [
|
||||||
|
'PhanTypeInvalidThrowsIsInterface',
|
||||||
|
],
|
||||||
|
|
||||||
|
// A regular expression to match files to be excluded
|
||||||
|
// from parsing and analysis and will not be read at all.
|
||||||
|
//
|
||||||
|
// This is useful for excluding groups of test or example
|
||||||
|
// directories/files, unanalyzable files, or files that
|
||||||
|
// can't be removed for whatever reason.
|
||||||
|
// (e.g. '@Test\.php$@', or '@vendor/.*/(tests|Tests)/@')
|
||||||
|
'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@',
|
||||||
|
|
||||||
|
// A file list that defines files that will be excluded
|
||||||
|
// from parsing and analysis and will not be read at all.
|
||||||
|
//
|
||||||
|
// This is useful for excluding hopelessly unanalyzable
|
||||||
|
// files that can't be removed for whatever reason.
|
||||||
|
'exclude_file_list' => [],
|
||||||
|
|
||||||
|
// A directory list that defines files that will be excluded
|
||||||
|
// from static analysis, but whose class and method
|
||||||
|
// information should be included.
|
||||||
|
//
|
||||||
|
// Generally, you'll want to include the directories for
|
||||||
|
// third-party code (such as "vendor/") in this list.
|
||||||
|
//
|
||||||
|
// n.b.: If you'd like to parse but not analyze 3rd
|
||||||
|
// party code, directories containing that code
|
||||||
|
// should be added to the `directory_list` as
|
||||||
|
// to `excluce_analysis_directory_list`.
|
||||||
|
'exclude_analysis_directory_list' => [
|
||||||
|
'vendor/',
|
||||||
|
],
|
||||||
|
|
||||||
|
// The number of processes to fork off during the analysis
|
||||||
|
// phase.
|
||||||
|
'processes' => 4,
|
||||||
|
|
||||||
|
// List of case-insensitive file extensions supported by Phan.
|
||||||
|
// (e.g. php, html, htm)
|
||||||
|
'analyzed_file_extensions' => [
|
||||||
|
'php',
|
||||||
|
],
|
||||||
|
|
||||||
|
// You can put paths to stubs of internal extensions in this config option.
|
||||||
|
// If the corresponding extension is **not** loaded, then phan will use the stubs instead.
|
||||||
|
// Phan will continue using its detailed type annotations,
|
||||||
|
// but load the constants, classes, functions, and classes (and their Reflection types)
|
||||||
|
// from these stub files (doubling as valid php files).
|
||||||
|
// Use a different extension from php to avoid accidentally loading these.
|
||||||
|
// The 'tools/make_stubs' script can be used to generate your own stubs (compatible with php 7.0+ right now)
|
||||||
|
'autoload_internal_extension_signatures' => [],
|
||||||
|
|
||||||
|
// A list of plugin files to execute
|
||||||
|
// Plugins which are bundled with Phan can be added here by providing their name (e.g. 'AlwaysReturnPlugin')
|
||||||
|
// Alternately, you can pass in the full path to a PHP file with the plugin's implementation (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
|
||||||
|
'plugins' => [
|
||||||
|
'AlwaysReturnPlugin',
|
||||||
|
'PregRegexCheckerPlugin',
|
||||||
|
'UnreachableCodePlugin',
|
||||||
|
],
|
||||||
|
|
||||||
|
// A list of directories that should be parsed for class and
|
||||||
|
// method information. After excluding the directories
|
||||||
|
// defined in exclude_analysis_directory_list, the remaining
|
||||||
|
// files will be statically analyzed for errors.
|
||||||
|
//
|
||||||
|
// Thus, both first-party and third-party code being used by
|
||||||
|
// your application should be included in this list.
|
||||||
|
'directory_list' => [
|
||||||
|
'src/App',
|
||||||
|
'vendor/',
|
||||||
|
],
|
||||||
|
];
|
||||||
@ -24,13 +24,18 @@
|
|||||||
"zendframework/zend-http": "^2.7",
|
"zendframework/zend-http": "^2.7",
|
||||||
"zendframework/zend-json": "^3.1",
|
"zendframework/zend-json": "^3.1",
|
||||||
"zendframework/zend-servicemanager": "^3.3",
|
"zendframework/zend-servicemanager": "^3.3",
|
||||||
"zendframework/zend-stdlib": "^3.1"
|
"zendframework/zend-stdlib": "^3.1",
|
||||||
|
"ext-openssl": "*",
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-libxml": "*",
|
||||||
|
"ext-json": "*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"filp/whoops": "^2.1.7",
|
||||||
|
"phan/phan": "^1.0",
|
||||||
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
|
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
|
||||||
"squizlabs/php_codesniffer": "^2.8.1",
|
"squizlabs/php_codesniffer": "^2.8.1",
|
||||||
"zfcampus/zf-development-mode": "^3.1",
|
"zfcampus/zf-development-mode": "^3.1"
|
||||||
"filp/whoops": "^2.1.7"
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
877
composer.lock
generated
877
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -36,7 +36,6 @@ return [
|
|||||||
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
|
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
|
||||||
|
|
||||||
'doctrine.entity_manager.orm_default' => \ContainerInteropDoctrine\EntityManagerFactory::class,
|
'doctrine.entity_manager.orm_default' => \ContainerInteropDoctrine\EntityManagerFactory::class,
|
||||||
'doctrine.hydrator' => \App\Hydrator\DoctrineObjectFactory::class,
|
|
||||||
|
|
||||||
\App\Middleware\EventSubscriberMiddleware::class => \App\Middleware\EventSubscriberMiddlewareFactory::class,
|
\App\Middleware\EventSubscriberMiddleware::class => \App\Middleware\EventSubscriberMiddlewareFactory::class,
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Zend\Stratigility\Middleware\ErrorHandler;
|
use Zend\Stratigility\Middleware\ErrorHandler;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@ -11,7 +13,8 @@ return [
|
|||||||
],
|
],
|
||||||
'delegators' => [
|
'delegators' => [
|
||||||
ErrorHandler::class => [
|
ErrorHandler::class => [
|
||||||
LosMiddleware\LosLog\ErrorHandlerListenerDelegatorFactory::class,
|
// LosMiddleware\LosLog\ErrorHandlerListenerDelegatorFactory::class,
|
||||||
|
App\Log\ExceptionHandlerListenerDelegatorFactory::class,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
@ -36,6 +38,8 @@ abstract class AbstractAction implements RequestHandlerInterface
|
|||||||
return $this->options($request);
|
return $this->options($request);
|
||||||
case 'PATCH':
|
case 'PATCH':
|
||||||
return $this->patch($request);
|
return $this->patch($request);
|
||||||
|
default:
|
||||||
|
return $this->createResponse(['content' => 'Method not allowed'], 405);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use App\Service\KoinService;
|
use App\Service\KoinService;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use App\Service\KoinService;
|
use App\Service\KoinService;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use App\Entity\Sms;
|
use App\Entity\Sms;
|
||||||
@ -17,12 +19,19 @@ class StoreAction extends AbstractAction
|
|||||||
$this->smsStore = $smsStore;
|
$this->smsStore = $smsStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ServerRequestInterface $request
|
||||||
|
* @return ResponseInterface
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
public function create(ServerRequestInterface $request): ResponseInterface
|
public function create(ServerRequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
$hashKey = $request->getAttribute('hashKey');
|
$hashKey = $request->getAttribute('hashKey');
|
||||||
$direction = $request->getAttribute('direction');
|
$direction = $request->getAttribute('direction');
|
||||||
$mappedDirection = Sms::MAP_DIRECTIONS[$direction];
|
$mappedDirection = Sms::MAP_DIRECTIONS[$direction];
|
||||||
$requestData = $this->getRequestData($request);
|
$requestData = $this->getRequestData($request);
|
||||||
|
|
||||||
$isStored = $this->smsStore->storeSms($hashKey, $mappedDirection, $requestData);
|
$isStored = $this->smsStore->storeSms($hashKey, $mappedDirection, $requestData);
|
||||||
return new JsonCorsResponse($isStored);
|
return new JsonCorsResponse($isStored);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Action;
|
namespace App\Action;
|
||||||
|
|
||||||
use App\Service\SmsStoreService;
|
use App\Service\SmsStoreService;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Entity\Sms;
|
use App\Entity\Sms;
|
||||||
@ -42,6 +44,13 @@ class KoinImportCommand extends Command
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param InputInterface $input
|
||||||
|
* @param OutputInterface $output
|
||||||
|
* @return int|null|void
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$smsId = $input->getArgument('id');
|
$smsId = $input->getArgument('id');
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Service\KoinService;
|
use App\Service\KoinService;
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Service\SZEPManagerService;
|
use App\Service\SZEPManagerService;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
@ -28,9 +29,16 @@ class PeriodicSZEPCommand extends Command
|
|||||||
->setDescription('Parse SZEP card');
|
->setDescription('Parse SZEP card');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param InputInterface $input
|
||||||
|
* @param OutputInterface $output
|
||||||
|
* @return int|null|void
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
* @throws \Doctrine\ORM\TransactionRequiredException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$result = $this->szepManager->pollRecent();
|
$this->szepManager->pollRecent();
|
||||||
$output->writeln($result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Command;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Service\SZEPManagerService;
|
use App\Service\SZEPManagerService;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Zend\EventManager\EventManager;
|
use Zend\EventManager\EventManager;
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM; // @phan-suppress-current-line PhanUnreferencedUseNormal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM; // @phan-suppress-current-line PhanUnreferencedUseNormal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@ -72,6 +74,12 @@ class Sms implements \JsonSerializable
|
|||||||
*/
|
*/
|
||||||
private $owner;
|
private $owner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="parsed_and_handled", type="boolean", options={"default" = true})
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $parsedAndHandled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -198,6 +206,24 @@ class Sms implements \JsonSerializable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isParsedAndHandled(): bool
|
||||||
|
{
|
||||||
|
return $this->parsedAndHandled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $parsedAndHandled
|
||||||
|
* @return Sms
|
||||||
|
*/
|
||||||
|
public function setParsedAndHandled(bool $parsedAndHandled): Sms
|
||||||
|
{
|
||||||
|
$this->parsedAndHandled = $parsedAndHandled;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify data which should be serialized to JSON
|
* Specify data which should be serialized to JSON
|
||||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||||
@ -215,6 +241,7 @@ class Sms implements \JsonSerializable
|
|||||||
'when' => $this->getOccuredAt(),
|
'when' => $this->getOccuredAt(),
|
||||||
'direction' => $this->getDirection(),
|
'direction' => $this->getDirection(),
|
||||||
'owner' => $this->getOwner(),
|
'owner' => $this->getOwner(),
|
||||||
|
'isParsedAndHandled' => $this->isParsedAndHandled(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM; // @phan-suppress-current-line PhanUnreferencedUseNormal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
@ -103,7 +105,7 @@ class User implements \JsonSerializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Sms[]|ArrayCollection
|
* @return ArrayCollection|Sms[]
|
||||||
*/
|
*/
|
||||||
public function getSmsMessages(): ?ArrayCollection
|
public function getSmsMessages(): ?ArrayCollection
|
||||||
{
|
{
|
||||||
@ -111,7 +113,7 @@ class User implements \JsonSerializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Sms[]|ArrayCollection $smsMessages
|
* @param ArrayCollection|null $smsMessages
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
public function setSmsMessages(?ArrayCollection $smsMessages): User
|
public function setSmsMessages(?ArrayCollection $smsMessages): User
|
||||||
|
|||||||
@ -1,594 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator;
|
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
|
||||||
use Doctrine\Common\Util\Inflector;
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use RuntimeException;
|
|
||||||
use Traversable;
|
|
||||||
use Zend\Stdlib\ArrayUtils;
|
|
||||||
use Zend\Hydrator\AbstractHydrator;
|
|
||||||
use Zend\Hydrator\Filter\FilterProviderInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This hydrator has been completely refactored for DoctrineModule 0.7.0. It provides an easy and powerful way
|
|
||||||
* of extracting/hydrator objects in Doctrine, by handling most associations types.
|
|
||||||
*
|
|
||||||
* Starting from DoctrineModule 0.8.0, the hydrator can be used multiple times with different objects
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
class DoctrineObject extends AbstractHydrator
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var ObjectManager
|
|
||||||
*/
|
|
||||||
protected $objectManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ClassMetadata
|
|
||||||
*/
|
|
||||||
protected $metadata;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $byValue = true;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param ObjectManager $objectManager The ObjectManager to use
|
|
||||||
* @param bool $byValue If set to true, hydrator will always use entity's public API
|
|
||||||
*/
|
|
||||||
public function __construct(ObjectManager $objectManager, $byValue = true)
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
$this->objectManager = $objectManager;
|
|
||||||
$this->byValue = (bool) $byValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract values from an object
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function extract($object)
|
|
||||||
{
|
|
||||||
$this->prepare($object);
|
|
||||||
|
|
||||||
if ($this->byValue) {
|
|
||||||
return $this->extractByValue($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->extractByReference($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hydrate $object with the provided $data.
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @param object $object
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public function hydrate(array $data, $object)
|
|
||||||
{
|
|
||||||
$this->prepare($object);
|
|
||||||
|
|
||||||
if ($this->byValue) {
|
|
||||||
return $this->hydrateByValue($data, $object);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->hydrateByReference($data, $object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare the hydrator by adding strategies to every collection valued associations
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function prepare($object)
|
|
||||||
{
|
|
||||||
$this->metadata = $this->objectManager->getClassMetadata(get_class($object));
|
|
||||||
$this->prepareStrategies();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prepare strategies before the hydrator is used
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function prepareStrategies()
|
|
||||||
{
|
|
||||||
$associations = $this->metadata->getAssociationNames();
|
|
||||||
|
|
||||||
foreach ($associations as $association) {
|
|
||||||
if ($this->metadata->isCollectionValuedAssociation($association)) {
|
|
||||||
// Add a strategy if the association has none set by user
|
|
||||||
if (!$this->hasStrategy($association)) {
|
|
||||||
if ($this->byValue) {
|
|
||||||
$this->addStrategy($association, new Strategy\AllowRemoveByValue());
|
|
||||||
} else {
|
|
||||||
$this->addStrategy($association, new Strategy\AllowRemoveByReference());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$strategy = $this->getStrategy($association);
|
|
||||||
|
|
||||||
if (!$strategy instanceof Strategy\AbstractCollectionStrategy) {
|
|
||||||
throw new InvalidArgumentException(
|
|
||||||
sprintf(
|
|
||||||
'Strategies used for collections valued associations must inherit from '
|
|
||||||
. 'Strategy\AbstractCollectionStrategy, %s given',
|
|
||||||
get_class($strategy)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$strategy->setCollectionName($association)
|
|
||||||
->setClassMetadata($this->metadata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract values from an object using a by-value logic (this means that it uses the entity
|
|
||||||
* API, in this case, getters)
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
* @throws RuntimeException
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function extractByValue($object)
|
|
||||||
{
|
|
||||||
$fieldNames = array_merge($this->metadata->getFieldNames(), $this->metadata->getAssociationNames());
|
|
||||||
$methods = get_class_methods($object);
|
|
||||||
$filter = $object instanceof FilterProviderInterface
|
|
||||||
? $object->getFilter()
|
|
||||||
: $this->filterComposite;
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
foreach ($fieldNames as $fieldName) {
|
|
||||||
if ($filter && !$filter->filter($fieldName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$getter = 'get' . Inflector::classify($fieldName);
|
|
||||||
$isser = 'is' . Inflector::classify($fieldName);
|
|
||||||
|
|
||||||
$dataFieldName = $this->computeExtractFieldName($fieldName);
|
|
||||||
if (in_array($getter, $methods)) {
|
|
||||||
$data[$dataFieldName] = $this->extractValue($fieldName, $object->$getter(), $object);
|
|
||||||
} elseif (in_array($isser, $methods)) {
|
|
||||||
$data[$dataFieldName] = $this->extractValue($fieldName, $object->$isser(), $object);
|
|
||||||
} elseif (substr($fieldName, 0, 2) === 'is'
|
|
||||||
&& ctype_upper(substr($fieldName, 2, 1))
|
|
||||||
&& in_array($fieldName, $methods)) {
|
|
||||||
$data[$dataFieldName] = $this->extractValue($fieldName, $object->$fieldName(), $object);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unknown fields are ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extract values from an object using a by-reference logic (this means that values are
|
|
||||||
* directly fetched without using the public API of the entity, in this case, getters)
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function extractByReference($object)
|
|
||||||
{
|
|
||||||
$fieldNames = array_merge($this->metadata->getFieldNames(), $this->metadata->getAssociationNames());
|
|
||||||
$refl = $this->metadata->getReflectionClass();
|
|
||||||
$filter = $object instanceof FilterProviderInterface
|
|
||||||
? $object->getFilter()
|
|
||||||
: $this->filterComposite;
|
|
||||||
|
|
||||||
$data = [];
|
|
||||||
foreach ($fieldNames as $fieldName) {
|
|
||||||
if ($filter && !$filter->filter($fieldName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$reflProperty = $refl->getProperty($fieldName);
|
|
||||||
$reflProperty->setAccessible(true);
|
|
||||||
|
|
||||||
$dataFieldName = $this->computeExtractFieldName($fieldName);
|
|
||||||
$data[$dataFieldName] = $this->extractValue($fieldName, $reflProperty->getValue($object), $object);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hydrate the object using a by-value logic (this means that it uses the entity API, in this
|
|
||||||
* case, setters)
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @param object $object
|
|
||||||
* @throws RuntimeException
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
protected function hydrateByValue(array $data, $object)
|
|
||||||
{
|
|
||||||
$tryObject = $this->tryConvertArrayToObject($data, $object);
|
|
||||||
$metadata = $this->metadata;
|
|
||||||
|
|
||||||
if (is_object($tryObject)) {
|
|
||||||
$object = $tryObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($data as $field => $value) {
|
|
||||||
$field = $this->computeHydrateFieldName($field);
|
|
||||||
$value = $this->handleTypeConversions($value, $metadata->getTypeOfField($field));
|
|
||||||
$setter = 'set' . Inflector::classify($field);
|
|
||||||
|
|
||||||
if ($metadata->hasAssociation($field)) {
|
|
||||||
$target = $metadata->getAssociationTargetClass($field);
|
|
||||||
|
|
||||||
if ($metadata->isSingleValuedAssociation($field)) {
|
|
||||||
if (! method_exists($object, $setter)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = $this->toOne($target, $this->hydrateValue($field, $value, $data));
|
|
||||||
|
|
||||||
if (null === $value
|
|
||||||
&& !current($metadata->getReflectionClass()->getMethod($setter)->getParameters())->allowsNull()
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$object->$setter($value);
|
|
||||||
} elseif ($metadata->isCollectionValuedAssociation($field)) {
|
|
||||||
$this->toMany($object, $field, $target, $value);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (! method_exists($object, $setter)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$object->$setter($this->hydrateValue($field, $value, $data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hydrate the object using a by-reference logic (this means that values are modified directly without
|
|
||||||
* using the public API, in this case setters, and hence override any logic that could be done in those
|
|
||||||
* setters)
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @param object $object
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
protected function hydrateByReference(array $data, $object)
|
|
||||||
{
|
|
||||||
$tryObject = $this->tryConvertArrayToObject($data, $object);
|
|
||||||
$metadata = $this->metadata;
|
|
||||||
$refl = $metadata->getReflectionClass();
|
|
||||||
|
|
||||||
if (is_object($tryObject)) {
|
|
||||||
$object = $tryObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($data as $field => $value) {
|
|
||||||
$field = $this->computeHydrateFieldName($field);
|
|
||||||
|
|
||||||
// Ignore unknown fields
|
|
||||||
if (!$refl->hasProperty($field)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$value = $this->handleTypeConversions($value, $metadata->getTypeOfField($field));
|
|
||||||
$reflProperty = $refl->getProperty($field);
|
|
||||||
$reflProperty->setAccessible(true);
|
|
||||||
|
|
||||||
if ($metadata->hasAssociation($field)) {
|
|
||||||
$target = $metadata->getAssociationTargetClass($field);
|
|
||||||
|
|
||||||
if ($metadata->isSingleValuedAssociation($field)) {
|
|
||||||
$value = $this->toOne($target, $this->hydrateValue($field, $value, $data));
|
|
||||||
$reflProperty->setValue($object, $value);
|
|
||||||
} elseif ($metadata->isCollectionValuedAssociation($field)) {
|
|
||||||
$this->toMany($object, $field, $target, $value);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$reflProperty->setValue($object, $this->hydrateValue($field, $value, $data));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function tries, given an array of data, to convert it to an object if the given array contains
|
|
||||||
* an identifier for the object. This is useful in a context of updating existing entities, without ugly
|
|
||||||
* tricks like setting manually the existing id directly into the entity
|
|
||||||
*
|
|
||||||
* @param array $data The data that may contain identifiers keys
|
|
||||||
* @param object $object
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
protected function tryConvertArrayToObject($data, $object)
|
|
||||||
{
|
|
||||||
$metadata = $this->metadata;
|
|
||||||
$identifierNames = $metadata->getIdentifierFieldNames($object);
|
|
||||||
$identifierValues = [];
|
|
||||||
|
|
||||||
if (empty($identifierNames)) {
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($identifierNames as $identifierName) {
|
|
||||||
if (!isset($data[$identifierName])) {
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
|
|
||||||
$identifierValues[$identifierName] = $data[$identifierName];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->find($identifierValues, $metadata->getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle ToOne associations
|
|
||||||
*
|
|
||||||
* When $value is an array but is not the $target's identifiers, $value is
|
|
||||||
* most likely an array of fieldset data. The identifiers will be determined
|
|
||||||
* and a target instance will be initialized and then hydrated. The hydrated
|
|
||||||
* target will be returned.
|
|
||||||
*
|
|
||||||
* @param string $target
|
|
||||||
* @param mixed $value
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
protected function toOne($target, $value)
|
|
||||||
{
|
|
||||||
$metadata = $this->objectManager->getClassMetadata($target);
|
|
||||||
|
|
||||||
if (is_array($value) && array_keys($value) != $metadata->getIdentifier()) {
|
|
||||||
// $value is most likely an array of fieldset data
|
|
||||||
$identifiers = array_intersect_key(
|
|
||||||
$value,
|
|
||||||
array_flip($metadata->getIdentifier())
|
|
||||||
);
|
|
||||||
$object = $this->find($identifiers, $target) ?: new $target;
|
|
||||||
return $this->hydrate($value, $object);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->find($value, $target);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle ToMany associations. In proper Doctrine design, Collections should not be swapped, so
|
|
||||||
* collections are always handled by reference. Internally, every collection is handled using specials
|
|
||||||
* strategies that inherit from AbstractCollectionStrategy class, and that add or remove elements but without
|
|
||||||
* changing the collection of the object
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
* @param mixed $collectionName
|
|
||||||
* @param string $target
|
|
||||||
* @param mixed $values
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function toMany($object, $collectionName, $target, $values)
|
|
||||||
{
|
|
||||||
$metadata = $this->objectManager->getClassMetadata(ltrim($target, '\\'));
|
|
||||||
$identifier = $metadata->getIdentifier();
|
|
||||||
|
|
||||||
if (!is_array($values) && !$values instanceof Traversable) {
|
|
||||||
$values = (array)$values;
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = [];
|
|
||||||
|
|
||||||
// If the collection contains identifiers, fetch the objects from database
|
|
||||||
foreach ($values as $value) {
|
|
||||||
if ($value instanceof $target) {
|
|
||||||
// assumes modifications have already taken place in object
|
|
||||||
$collection[] = $value;
|
|
||||||
continue;
|
|
||||||
} elseif (empty($value)) {
|
|
||||||
// assumes no id and retrieves new $target
|
|
||||||
$collection[] = $this->find($value, $target);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$find = [];
|
|
||||||
if (is_array($identifier)) {
|
|
||||||
foreach ($identifier as $field) {
|
|
||||||
switch (gettype($value)) {
|
|
||||||
case 'object':
|
|
||||||
$getter = 'get' . ucfirst($field);
|
|
||||||
if (method_exists($value, $getter)) {
|
|
||||||
$find[$field] = $value->$getter();
|
|
||||||
} elseif (property_exists($value, $field)) {
|
|
||||||
$find[$field] = $value->$field;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'array':
|
|
||||||
if (array_key_exists($field, $value) && $value[$field] != null) {
|
|
||||||
$find[$field] = $value[$field];
|
|
||||||
unset($value[$field]); // removed identifier from persistable data
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$find[$field] = $value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($find) && $found = $this->find($find, $target)) {
|
|
||||||
$collection[] = (is_array($value)) ? $this->hydrate($value, $found) : $found;
|
|
||||||
} else {
|
|
||||||
$collection[] = (is_array($value)) ? $this->hydrate($value, new $target) : new $target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = array_filter(
|
|
||||||
$collection,
|
|
||||||
function ($item) {
|
|
||||||
return null !== $item;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Set the object so that the strategy can extract the Collection from it
|
|
||||||
|
|
||||||
/** @var \DoctrineModule\Stdlib\Hydrator\Strategy\AbstractCollectionStrategy $collectionStrategy */
|
|
||||||
$collectionStrategy = $this->getStrategy($collectionName);
|
|
||||||
$collectionStrategy->setObject($object);
|
|
||||||
|
|
||||||
// We could directly call hydrate method from the strategy, but if people want to override
|
|
||||||
// hydrateValue function, they can do it and do their own stuff
|
|
||||||
$this->hydrateValue($collectionName, $collection, $values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle various type conversions that should be supported natively by Doctrine (like DateTime)
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
* @param string $typeOfField
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
|
||||||
protected function handleTypeConversions($value, $typeOfField)
|
|
||||||
{
|
|
||||||
switch ($typeOfField) {
|
|
||||||
case 'datetimetz':
|
|
||||||
case 'datetime':
|
|
||||||
case 'time':
|
|
||||||
case 'date':
|
|
||||||
if ('' === $value) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_int($value)) {
|
|
||||||
$dateTime = new DateTime();
|
|
||||||
$dateTime->setTimestamp($value);
|
|
||||||
$value = $dateTime;
|
|
||||||
} elseif (is_string($value)) {
|
|
||||||
$value = new DateTime($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find an object by a given target class and identifier
|
|
||||||
*
|
|
||||||
* @param mixed $identifiers
|
|
||||||
* @param string $targetClass
|
|
||||||
*
|
|
||||||
* @return object|null
|
|
||||||
*/
|
|
||||||
protected function find($identifiers, $targetClass)
|
|
||||||
{
|
|
||||||
if ($identifiers instanceof $targetClass) {
|
|
||||||
return $identifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->isNullIdentifier($identifiers)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->objectManager->find($targetClass, $identifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verifies if a provided identifier is to be considered null
|
|
||||||
*
|
|
||||||
* @param mixed $identifier
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
private function isNullIdentifier($identifier)
|
|
||||||
{
|
|
||||||
if (null === $identifier) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($identifier instanceof Traversable || is_array($identifier)) {
|
|
||||||
$nonNullIdentifiers = array_filter(
|
|
||||||
ArrayUtils::iteratorToArray($identifier),
|
|
||||||
function ($value) {
|
|
||||||
return null !== $value;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return empty($nonNullIdentifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the naming strategy if there is one set
|
|
||||||
*
|
|
||||||
* @param string $field
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function computeHydrateFieldName($field)
|
|
||||||
{
|
|
||||||
if ($this->hasNamingStrategy()) {
|
|
||||||
$field = $this->getNamingStrategy()->hydrate($field);
|
|
||||||
}
|
|
||||||
return $field;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the naming strategy if there is one set
|
|
||||||
*
|
|
||||||
* @param string $field
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function computeExtractFieldName($field)
|
|
||||||
{
|
|
||||||
if ($this->hasNamingStrategy()) {
|
|
||||||
$field = $this->getNamingStrategy()->extract($field);
|
|
||||||
}
|
|
||||||
return $field;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Hydrator;
|
|
||||||
|
|
||||||
use Interop\Container\ContainerInterface;
|
|
||||||
|
|
||||||
class DoctrineObjectFactory
|
|
||||||
{
|
|
||||||
|
|
||||||
public function __invoke(ContainerInterface $container)
|
|
||||||
{
|
|
||||||
$em = $container->get('doctrine.entity_manager.orm_default');
|
|
||||||
return new DoctrineObject($em);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Filter;
|
|
||||||
|
|
||||||
use Zend\Hydrator\Filter\FilterInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides a filter to restrict returned fields by whitelisting or
|
|
||||||
* blacklisting property names.
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @author Liam O'Boyle <liam@ontheroad.net.nz>
|
|
||||||
*/
|
|
||||||
class PropertyName implements FilterInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The propteries to exclude.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $properties = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Either an exclude or an include.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $exclude = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param [ string | array ] $properties The properties to exclude or include.
|
|
||||||
* @param bool $exclude If the method should be excluded
|
|
||||||
*/
|
|
||||||
public function __construct($properties, $exclude = true)
|
|
||||||
{
|
|
||||||
$this->exclude = $exclude;
|
|
||||||
$this->properties = is_array($properties)
|
|
||||||
? $properties
|
|
||||||
: [$properties];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function filter($property)
|
|
||||||
{
|
|
||||||
return in_array($property, $this->properties)
|
|
||||||
? !$this->exclude
|
|
||||||
: $this->exclude;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,190 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Strategy;
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
|
||||||
use Zend\Hydrator\Strategy\StrategyInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
abstract class AbstractCollectionStrategy implements StrategyInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $collectionName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ClassMetadata
|
|
||||||
*/
|
|
||||||
protected $metadata;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var object
|
|
||||||
*/
|
|
||||||
protected $object;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name of the collection
|
|
||||||
*
|
|
||||||
* @param string $collectionName
|
|
||||||
* @return AbstractCollectionStrategy
|
|
||||||
*/
|
|
||||||
public function setCollectionName($collectionName)
|
|
||||||
{
|
|
||||||
$this->collectionName = (string) $collectionName;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the collection
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCollectionName()
|
|
||||||
{
|
|
||||||
return $this->collectionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the class metadata
|
|
||||||
*
|
|
||||||
* @param ClassMetadata $classMetadata
|
|
||||||
* @return AbstractCollectionStrategy
|
|
||||||
*/
|
|
||||||
public function setClassMetadata(ClassMetadata $classMetadata)
|
|
||||||
{
|
|
||||||
$this->metadata = $classMetadata;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the class metadata
|
|
||||||
*
|
|
||||||
* @return ClassMetadata
|
|
||||||
*/
|
|
||||||
public function getClassMetadata()
|
|
||||||
{
|
|
||||||
return $this->metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the object
|
|
||||||
*
|
|
||||||
* @param object $object
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*
|
|
||||||
* @return AbstractCollectionStrategy
|
|
||||||
*/
|
|
||||||
public function setObject($object)
|
|
||||||
{
|
|
||||||
if (!is_object($object)) {
|
|
||||||
throw new InvalidArgumentException(
|
|
||||||
sprintf('The parameter given to setObject method of %s class is not an object', get_called_class())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->object = $object;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the object
|
|
||||||
*
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public function getObject()
|
|
||||||
{
|
|
||||||
return $this->object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function extract($value)
|
|
||||||
{
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the collection by value (using the public API)
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
protected function getCollectionFromObjectByValue()
|
|
||||||
{
|
|
||||||
$object = $this->getObject();
|
|
||||||
$getter = 'get' . ucfirst($this->getCollectionName());
|
|
||||||
|
|
||||||
if (!method_exists($object, $getter)) {
|
|
||||||
throw new InvalidArgumentException(
|
|
||||||
sprintf(
|
|
||||||
'The getter %s to access collection %s in object %s does not exist',
|
|
||||||
$getter,
|
|
||||||
$this->getCollectionName(),
|
|
||||||
get_class($object)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $object->$getter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the collection by reference (not using the public API)
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
protected function getCollectionFromObjectByReference()
|
|
||||||
{
|
|
||||||
$object = $this->getObject();
|
|
||||||
$refl = $this->getClassMetadata()->getReflectionClass();
|
|
||||||
$reflProperty = $refl->getProperty($this->getCollectionName());
|
|
||||||
|
|
||||||
$reflProperty->setAccessible(true);
|
|
||||||
|
|
||||||
return $reflProperty->getValue($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is used internally by array_udiff to check if two objects are equal, according to their
|
|
||||||
* SPL hash. This is needed because the native array_diff only compare strings
|
|
||||||
*
|
|
||||||
* @param object $a
|
|
||||||
* @param object $b
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
protected function compareObjects($a, $b)
|
|
||||||
{
|
|
||||||
return strcmp(spl_object_hash($a), spl_object_hash($b));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Strategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
|
|
||||||
* the original collection, then this strategy remove elements from the original collection. For instance, if the
|
|
||||||
* collection initially contains elements A and B, and that the new collection contains elements B and C, then the
|
|
||||||
* final collection will contain elements B and C (while element A will be asked to be removed).
|
|
||||||
*
|
|
||||||
* This strategy is by reference, this means it won't use public API to add/remove elements to the collection
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
class AllowRemoveByReference extends AbstractCollectionStrategy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function hydrate($value)
|
|
||||||
{
|
|
||||||
$collection = $this->getCollectionFromObjectByReference();
|
|
||||||
$collectionArray = $collection->toArray();
|
|
||||||
|
|
||||||
$toAdd = array_udiff($value, $collectionArray, [$this, 'compareObjects']);
|
|
||||||
$toRemove = array_udiff($collectionArray, $value, [$this, 'compareObjects']);
|
|
||||||
|
|
||||||
foreach ($toAdd as $element) {
|
|
||||||
$collection->add($element);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($toRemove as $element) {
|
|
||||||
$collection->removeElement($element);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Strategy;
|
|
||||||
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use LogicException;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
|
|
||||||
* the original collection, then this strategy remove elements from the original collection. For instance, if the
|
|
||||||
* collection initially contains elements A and B, and that the new collection contains elements B and C, then the
|
|
||||||
* final collection will contain elements B and C (while element A will be asked to be removed).
|
|
||||||
*
|
|
||||||
* This strategy is by value, this means it will use the public API (in this case, adder and remover)
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
class AllowRemoveByValue extends AbstractCollectionStrategy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function hydrate($value)
|
|
||||||
{
|
|
||||||
// AllowRemove strategy need "adder" and "remover"
|
|
||||||
$adder = 'add' . ucfirst($this->collectionName);
|
|
||||||
$remover = 'remove' . ucfirst($this->collectionName);
|
|
||||||
|
|
||||||
if (!method_exists($this->object, $adder) || !method_exists($this->object, $remover)) {
|
|
||||||
throw new LogicException(
|
|
||||||
sprintf(
|
|
||||||
'AllowRemove strategy for DoctrineModule hydrator requires both %s and %s to be defined in %s
|
|
||||||
entity domain code, but one or both seem to be missing',
|
|
||||||
$adder,
|
|
||||||
$remover,
|
|
||||||
get_class($this->object)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = $this->getCollectionFromObjectByValue();
|
|
||||||
|
|
||||||
if ($collection instanceof Collection) {
|
|
||||||
$collection = $collection->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
$toAdd = new ArrayCollection(array_udiff($value, $collection, [$this, 'compareObjects']));
|
|
||||||
$toRemove = new ArrayCollection(array_udiff($collection, $value, [$this, 'compareObjects']));
|
|
||||||
|
|
||||||
$this->object->$adder($toAdd);
|
|
||||||
$this->object->$remover($toRemove);
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Strategy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
|
|
||||||
* the original collection, then this strategy will not remove those elements. At most, it will add new elements. For
|
|
||||||
* instance, if the collection initially contains elements A and B, and that the new collection contains elements B
|
|
||||||
* and C, then the final collection will contain elements A, B and C.
|
|
||||||
*
|
|
||||||
* This strategy is by reference, this means it won't use the public API to remove elements
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
class DisallowRemoveByReference extends AbstractCollectionStrategy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function hydrate($value)
|
|
||||||
{
|
|
||||||
$collection = $this->getCollectionFromObjectByReference();
|
|
||||||
$collectionArray = $collection->toArray();
|
|
||||||
|
|
||||||
$toAdd = array_udiff($value, $collectionArray, [$this, 'compareObjects']);
|
|
||||||
|
|
||||||
foreach ($toAdd as $element) {
|
|
||||||
$collection->add($element);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This software consists of voluntary contributions made by many individuals
|
|
||||||
* and is licensed under the MIT license. For more information, see
|
|
||||||
* <http://www.doctrine-project.org>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Hydrator\Strategy;
|
|
||||||
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use LogicException;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When this strategy is used for Collections, if the new collection does not contain elements that are present in
|
|
||||||
* the original collection, then this strategy will not remove those elements. At most, it will add new elements. For
|
|
||||||
* instance, if the collection initially contains elements A and B, and that the new collection contains elements B
|
|
||||||
* and C, then the final collection will contain elements A, B and C.
|
|
||||||
*
|
|
||||||
* This strategy is by value, this means it will use the public API (in this case, remover)
|
|
||||||
*
|
|
||||||
* @license MIT
|
|
||||||
* @link http://www.doctrine-project.org/
|
|
||||||
* @since 0.7.0
|
|
||||||
* @author Michael Gallego <mic.gallego@gmail.com>
|
|
||||||
*/
|
|
||||||
class DisallowRemoveByValue extends AbstractCollectionStrategy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function hydrate($value)
|
|
||||||
{
|
|
||||||
// AllowRemove strategy need "adder"
|
|
||||||
$adder = 'add' . ucfirst($this->collectionName);
|
|
||||||
|
|
||||||
if (!method_exists($this->object, $adder)) {
|
|
||||||
throw new LogicException(
|
|
||||||
sprintf(
|
|
||||||
'DisallowRemove strategy for DoctrineModule hydrator requires %s to
|
|
||||||
be defined in %s entity domain code, but it seems to be missing',
|
|
||||||
$adder,
|
|
||||||
get_class($this->object)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$collection = $this->getCollectionFromObjectByValue();
|
|
||||||
|
|
||||||
if ($collection instanceof Collection) {
|
|
||||||
$collection = $collection->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
$toAdd = new ArrayCollection(array_udiff($value, $collection, [$this, 'compareObjects']));
|
|
||||||
|
|
||||||
$this->object->$adder($toAdd);
|
|
||||||
|
|
||||||
return $collection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
37
src/App/Logger/ExceptionHandlerListenerDelegatorFactory.php
Normal file
37
src/App/Logger/ExceptionHandlerListenerDelegatorFactory.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Log;
|
||||||
|
|
||||||
|
use Interop\Container\ContainerInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Zend\ServiceManager\Factory\DelegatorFactoryInterface;
|
||||||
|
use Zend\Stratigility\Middleware\ErrorHandler;
|
||||||
|
|
||||||
|
class ExceptionHandlerListenerDelegatorFactory implements DelegatorFactoryInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param ContainerInterface $container
|
||||||
|
* @param string $name
|
||||||
|
* @param callable $callback
|
||||||
|
* @param array|null $options
|
||||||
|
* @return object|ErrorHandler
|
||||||
|
* @throws \Psr\Container\ContainerExceptionInterface
|
||||||
|
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function __invoke(ContainerInterface $container, $name, callable $callback, array $options = null)
|
||||||
|
{
|
||||||
|
if (! $container->has(LoggerInterface::class)) {
|
||||||
|
throw new \RuntimeException(
|
||||||
|
"You must define a factory for LoggerInterface. Check loslog.global.php.dist for an example."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$logger = $container->get(LoggerInterface::class);
|
||||||
|
|
||||||
|
/* @var ErrorHandler $errorHandler */
|
||||||
|
$errorHandler = $callback();
|
||||||
|
$errorHandler->attachListener(new LosLogExceptionListener($logger));
|
||||||
|
return $errorHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/App/Logger/LosLogExceptionListener.php
Normal file
43
src/App/Logger/LosLogExceptionListener.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Log;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
class LosLogExceptionListener
|
||||||
|
{
|
||||||
|
const LOG_FORMAT = "%d [%s] %s: %s. File: %s:%s\n%s";
|
||||||
|
private $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LosLogListener constructor.
|
||||||
|
* @param LoggerInterface $logger
|
||||||
|
*/
|
||||||
|
public function __construct(LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Throwable $error
|
||||||
|
* @param Request $request
|
||||||
|
* @param Response $response
|
||||||
|
*/
|
||||||
|
public function __invoke($error, Request $request, Response $response)
|
||||||
|
{
|
||||||
|
$this->logger->error(sprintf(
|
||||||
|
self::LOG_FORMAT,
|
||||||
|
$response->getStatusCode(),
|
||||||
|
$request->getMethod(),
|
||||||
|
(string) $request->getUri(),
|
||||||
|
$error->getMessage(),
|
||||||
|
$error->getFile(),
|
||||||
|
$error->getLine(),
|
||||||
|
$error->getTraceAsString()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Middleware;
|
namespace App\Middleware;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Middleware;
|
namespace App\Middleware;
|
||||||
|
|
||||||
use App\Service\KoinService;
|
use App\Service\KoinService;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Middleware;
|
namespace App\Middleware;
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Response;
|
namespace App\Response;
|
||||||
|
|
||||||
use Zend\Diactoros\Response\JsonResponse;
|
use Zend\Diactoros\Response\JsonResponse;
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Sms;
|
use App\Entity\Sms;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Zend\EventManager\Event;
|
use Zend\EventManager\Event;
|
||||||
@ -28,48 +29,43 @@ class KoinService
|
|||||||
*/
|
*/
|
||||||
const OTP_SMS_PATTERN = '#([0-9]{6}) ([0-9]{1,2}:[0-9]{1,2}) K[áà]rty[áà]s v[áà]s[áà]rl[áà]s/z[áà]rol[áà]s: -([0-9,.]+) ([A-Z]{2,3}); (.*?); K[áà]rtyasz[áà]m: ...[0-9]{4}; Egyenleg: \+[0-9.]+ HUF - OTPdirekt#msiu';
|
const OTP_SMS_PATTERN = '#([0-9]{6}) ([0-9]{1,2}:[0-9]{1,2}) K[áà]rty[áà]s v[áà]s[áà]rl[áà]s/z[áà]rol[áà]s: -([0-9,.]+) ([A-Z]{2,3}); (.*?); K[áà]rtyasz[áà]m: ...[0-9]{4}; Egyenleg: \+[0-9.]+ HUF - OTPdirekt#msiu';
|
||||||
|
|
||||||
/**
|
/** @var Client */
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var Client
|
|
||||||
*/
|
|
||||||
private $httpClient;
|
private $httpClient;
|
||||||
|
|
||||||
/**
|
/** @var array */
|
||||||
* @var string
|
private $config;
|
||||||
*/
|
|
||||||
|
/** @var EntityManager */
|
||||||
|
private $entityManager;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
private $accountId;
|
private $accountId;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $csrfParam;
|
private $csrfParam;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $csrfToken;
|
private $csrfToken;
|
||||||
|
|
||||||
/**
|
/** @var array */
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $expenseCategories = [];
|
private $expenseCategories = [];
|
||||||
|
|
||||||
/**
|
/** @var array */
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $incomeCategories = [];
|
private $incomeCategories = [];
|
||||||
|
|
||||||
|
|
||||||
public function __construct(Client $httpClient, array $config)
|
public function __construct(Client $httpClient, array $config, EntityManager $em)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->httpClient = $httpClient;
|
$this->httpClient = $httpClient;
|
||||||
|
$this->entityManager = $em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Event $event
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
public function onReceiveSmsListener(Event $event)
|
public function onReceiveSmsListener(Event $event)
|
||||||
{
|
{
|
||||||
$this->onReceiveSms($event->getParam('sms'));
|
$this->onReceiveSms($event->getParam('sms'));
|
||||||
@ -78,20 +74,30 @@ class KoinService
|
|||||||
/**
|
/**
|
||||||
* @param Sms $sms
|
* @param Sms $sms
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
*/
|
*/
|
||||||
public function onReceiveSms(Sms $sms)
|
public function onReceiveSms(Sms $sms)
|
||||||
{
|
{
|
||||||
|
$setIsHandledFlag = true;
|
||||||
if (1 === ($matchStatus = preg_match(self::OTP_SMS_PATTERN, $sms->getText(), $otpMatches))) {
|
if (1 === ($matchStatus = preg_match(self::OTP_SMS_PATTERN, $sms->getText(), $otpMatches))) {
|
||||||
$datePart = implode("-", sscanf($otpMatches[1], '%2c%2c%2c'));
|
$datePart = implode("-", sscanf($otpMatches[1], '%2c%2c%2c'));
|
||||||
|
|
||||||
$this->saveTransaction(
|
$result = $this->saveTransaction(
|
||||||
str_replace(",", ".", str_replace(".", "", $otpMatches[3])),
|
str_replace(",", ".", str_replace(".", "", $otpMatches[3])),
|
||||||
$otpMatches[4],
|
$otpMatches[4],
|
||||||
"20${datePart}",
|
"20${datePart}",
|
||||||
$this->getExpenseCategory($otpMatches[5]),
|
$this->getExpenseCategory($otpMatches[5]),
|
||||||
$this->getExpenseTags($otpMatches[5])
|
$this->getExpenseTags($otpMatches[5])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( 200 > $result || 299 < $result) {
|
||||||
|
$setIsHandledFlag = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sms->setParsedAndHandled($setIsHandledFlag);
|
||||||
|
$this->entityManager->flush();
|
||||||
return $matchStatus;
|
return $matchStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +139,18 @@ class KoinService
|
|||||||
return 'Étel';
|
return 'Étel';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "HAI NAM BISTRÓ")) {
|
||||||
|
return 'Étel';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "FIRPO BURGER")) {
|
||||||
|
return 'Étel';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "VENDIT AUTOMATÁK")) {
|
||||||
|
return 'Étel';
|
||||||
|
}
|
||||||
|
|
||||||
if (false !== strpos($posInfo, "SZLOVàK ABC")) {
|
if (false !== strpos($posInfo, "SZLOVàK ABC")) {
|
||||||
return 'Bevásárlás';
|
return 'Bevásárlás';
|
||||||
}
|
}
|
||||||
@ -173,6 +191,14 @@ class KoinService
|
|||||||
return 'Közművek';
|
return 'Közművek';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "FUNDAMENTA")) {
|
||||||
|
return 'Megtakarítás';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "STEAMGAMES")) {
|
||||||
|
return 'Szórakozás';
|
||||||
|
}
|
||||||
|
|
||||||
if (false !== strpos($posInfo, "Aqua Electromax")) {
|
if (false !== strpos($posInfo, "Aqua Electromax")) {
|
||||||
return 'Szórakozás';
|
return 'Szórakozás';
|
||||||
}
|
}
|
||||||
@ -181,6 +207,10 @@ class KoinService
|
|||||||
return 'Sport';
|
return 'Sport';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (false !== strpos($posInfo, "JYSK")) {
|
||||||
|
return 'Háztartás';
|
||||||
|
}
|
||||||
|
|
||||||
if (false !== strpos($posInfo, "MOL TÖLTÖàLL")) {
|
if (false !== strpos($posInfo, "MOL TÖLTÖàLL")) {
|
||||||
return 'Autó';
|
return 'Autó';
|
||||||
}
|
}
|
||||||
@ -226,8 +256,20 @@ class KoinService
|
|||||||
} elseif (false !== strpos($posInfo, "BKK AUTOMATA")) {
|
} elseif (false !== strpos($posInfo, "BKK AUTOMATA")) {
|
||||||
$tags[] = "Bérlet";
|
$tags[] = "Bérlet";
|
||||||
$tags[] = "BKV";
|
$tags[] = "BKV";
|
||||||
|
} elseif (false !== strpos($posInfo, "BKK-AUTOMATA")) {
|
||||||
|
$tags[] = "Bérlet";
|
||||||
|
$tags[] = "BKV";
|
||||||
} elseif (false !== strpos($posInfo, "SPAR")) {
|
} elseif (false !== strpos($posInfo, "SPAR")) {
|
||||||
$tags[] = 'Spar';
|
$tags[] = 'Spar';
|
||||||
|
} elseif (false !== strpos($posInfo, "HAI NAM BISTRÓ")) {
|
||||||
|
$tags[] = 'Hai Nam Bistro';
|
||||||
|
$tags[] = 'Vietnámi';
|
||||||
|
} elseif (false !== strpos($posInfo, "FIRPO BURGER")) {
|
||||||
|
$tags[] = 'Firpo Burger';
|
||||||
|
$tags[] = 'Burger';
|
||||||
|
} elseif (false !== strpos($posInfo, "VENDIT AUTOMATÁK")) {
|
||||||
|
$tags[] = 'Junk food';
|
||||||
|
$tags[] = 'Automata';
|
||||||
} elseif (false !== strpos($posInfo, "TESCO")) {
|
} elseif (false !== strpos($posInfo, "TESCO")) {
|
||||||
$tags[] = 'Tesco';
|
$tags[] = 'Tesco';
|
||||||
} elseif (false !== strpos($posInfo, "SZLOVàK ABC")) {
|
} elseif (false !== strpos($posInfo, "SZLOVàK ABC")) {
|
||||||
@ -256,10 +298,17 @@ class KoinService
|
|||||||
$tags[] = 'Google play';
|
$tags[] = 'Google play';
|
||||||
} elseif (false !== strpos($posInfo, "DIGI ")) {
|
} elseif (false !== strpos($posInfo, "DIGI ")) {
|
||||||
$tags[] = 'Digi';
|
$tags[] = 'Digi';
|
||||||
|
} elseif (false !== strpos($posInfo, "FUNDAMENTA")) {
|
||||||
|
$tags[] = 'Fundamenta';
|
||||||
|
} elseif (false !== strpos($posInfo, "STEAMGAMES")) {
|
||||||
|
$tags[] = 'Steam';
|
||||||
|
$tags[] = 'Gáma';
|
||||||
} elseif (false !== strpos($posInfo, "Aqua Electromax")) {
|
} elseif (false !== strpos($posInfo, "Aqua Electromax")) {
|
||||||
$tags[] = 'Aqua';
|
$tags[] = 'Aqua';
|
||||||
} elseif (false !== strpos($posInfo, "DECATHLON")) {
|
} elseif (false !== strpos($posInfo, "DECATHLON")) {
|
||||||
$tags[] = 'Decathlon';
|
$tags[] = 'Decathlon';
|
||||||
|
} elseif (false !== strpos($posInfo, "JYSK")) {
|
||||||
|
$tags[] = 'Jysk';
|
||||||
} elseif (false !== strpos($posInfo, "MOL TÖLTÖàLL")) {
|
} elseif (false !== strpos($posInfo, "MOL TÖLTÖàLL")) {
|
||||||
$tags[] = 'MOL';
|
$tags[] = 'MOL';
|
||||||
$tags[] = 'Benzinkút';
|
$tags[] = 'Benzinkút';
|
||||||
@ -286,14 +335,14 @@ class KoinService
|
|||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function saveTransaction(string $amount,
|
public function saveTransaction(string $amount,
|
||||||
string $currency = 'HUF',
|
string $currency,
|
||||||
string $date,
|
string $date,
|
||||||
string $category,
|
string $category,
|
||||||
array $tags): int
|
array $tags): int
|
||||||
{
|
{
|
||||||
$pageData = $this->login($this->config['koin.user'], $this->config['koin.pass']);
|
$pageData = $this->login($this->config['koin.user'], $this->config['koin.pass']);
|
||||||
|
|
||||||
$this->loadFormData($pageData->getBody());
|
$this->loadFormData($pageData->getBody()->getContents());
|
||||||
return $this->postData(
|
return $this->postData(
|
||||||
$amount,
|
$amount,
|
||||||
$currency,
|
$currency,
|
||||||
@ -314,7 +363,7 @@ class KoinService
|
|||||||
|
|
||||||
$body = $httpResponse->getBody();
|
$body = $httpResponse->getBody();
|
||||||
|
|
||||||
$this->getCsrfToken($body);
|
$this->getCsrfToken($body->getContents());
|
||||||
|
|
||||||
$httpResponse = $this->httpClient
|
$httpResponse = $this->httpClient
|
||||||
->post(self::BASE_URI . "/site/login", [
|
->post(self::BASE_URI . "/site/login", [
|
||||||
@ -336,9 +385,7 @@ class KoinService
|
|||||||
$documentXpath = $this->getCsrfToken($htmlData);
|
$documentXpath = $this->getCsrfToken($htmlData);
|
||||||
$this->getAccountId($documentXpath);
|
$this->getAccountId($documentXpath);
|
||||||
|
|
||||||
/** @var \DOMNodeList $expenseOptionElements */
|
|
||||||
$expenseOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Kiadás"]/option');
|
$expenseOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Kiadás"]/option');
|
||||||
/** @var \DOMNodeList $incomeOptionElements */
|
|
||||||
$incomeOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Bevétel"]/option');
|
$incomeOptionElements = $documentXpath->query('//select[@id="transaction-category_id"]/optgroup[@label="Bevétel"]/option');
|
||||||
|
|
||||||
/** @var \DOMElement $element */
|
/** @var \DOMElement $element */
|
||||||
@ -367,13 +414,15 @@ class KoinService
|
|||||||
libxml_use_internal_errors($xmlErrorHandling);
|
libxml_use_internal_errors($xmlErrorHandling);
|
||||||
|
|
||||||
$documentXpath = new \DOMXPath($domDocument);
|
$documentXpath = new \DOMXPath($domDocument);
|
||||||
/** @var \DOMElement $paramElement */
|
|
||||||
$paramElement = $documentXpath->query('//meta[@name="csrf-param"]')->item(0);
|
$paramElement = $documentXpath->query('//meta[@name="csrf-param"]')->item(0);
|
||||||
/** @var \DOMElement $tokenElement */
|
|
||||||
$tokenElement = $documentXpath->query('//meta[@name="csrf-token"]')->item(0);
|
$tokenElement = $documentXpath->query('//meta[@name="csrf-token"]')->item(0);
|
||||||
|
|
||||||
$this->csrfParam = $paramElement->getAttribute("content");
|
if ($paramElement instanceof \DOMElement) {
|
||||||
$this->csrfToken = $tokenElement->getAttribute("content");
|
$this->csrfParam = $paramElement->getAttribute("content");
|
||||||
|
}
|
||||||
|
if ($tokenElement instanceof \DOMElement) {
|
||||||
|
$this->csrfToken = $tokenElement->getAttribute("content");
|
||||||
|
}
|
||||||
|
|
||||||
return $documentXpath;
|
return $documentXpath;
|
||||||
}
|
}
|
||||||
@ -384,9 +433,10 @@ class KoinService
|
|||||||
*/
|
*/
|
||||||
private function getAccountId(\DOMXPath $documentXpath)
|
private function getAccountId(\DOMXPath $documentXpath)
|
||||||
{
|
{
|
||||||
/** @var \DOMElement $accountIdElement */
|
|
||||||
$accountIdElement = $documentXpath->query('//input[@id="transaction-account_id"]')->item(0);
|
$accountIdElement = $documentXpath->query('//input[@id="transaction-account_id"]')->item(0);
|
||||||
$this->accountId = $accountIdElement->getAttribute("value");
|
if ($accountIdElement instanceof \DOMElement) {
|
||||||
|
$this->accountId = $accountIdElement->getAttribute("value");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -397,7 +447,7 @@ class KoinService
|
|||||||
* @param string $tags
|
* @param string $tags
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function postData(string $amount, string $currency = 'HUF', string $date, string $category, string $tags): int
|
private function postData(string $amount, string $currency, string $date, string $category, string $tags): int
|
||||||
{
|
{
|
||||||
$saveResponse = $this->httpClient
|
$saveResponse = $this->httpClient
|
||||||
->post(self::BASE_URI . "/main/save-transaction", [
|
->post(self::BASE_URI . "/main/save-transaction", [
|
||||||
|
|||||||
@ -1,22 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
|
|
||||||
|
|
||||||
class KoinServiceFactory
|
class KoinServiceFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
public function __invoke(ContainerInterface $container)
|
/**
|
||||||
{
|
* @param ContainerInterface $container
|
||||||
$httpClient = new Client([
|
* @return KoinService
|
||||||
'cookies' => true,
|
*/
|
||||||
]);
|
public function __invoke(ContainerInterface $container)
|
||||||
$config = $container->get('config');
|
{
|
||||||
return new KoinService($httpClient, $config);
|
$httpClient = new Client([
|
||||||
}
|
'cookies' => true,
|
||||||
|
]);
|
||||||
|
$config = $container->get('config');
|
||||||
|
$em = $container->get('doctrine.entity_manager.orm_default');
|
||||||
|
|
||||||
|
return new KoinService($httpClient, $config, $em);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Entity\SZEPCardEntry;
|
use App\Entity\SZEPCardEntry;
|
||||||
@ -114,6 +116,7 @@ class SZEPManagerService
|
|||||||
* @throws \Doctrine\ORM\ORMException
|
* @throws \Doctrine\ORM\ORMException
|
||||||
* @throws \Doctrine\ORM\OptimisticLockException
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
* @throws \Doctrine\ORM\TransactionRequiredException
|
* @throws \Doctrine\ORM\TransactionRequiredException
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function parseResult(string $resultXml)
|
private function parseResult(string $resultXml)
|
||||||
{
|
{
|
||||||
@ -140,7 +143,7 @@ class SZEPManagerService
|
|||||||
|
|
||||||
$szepCardEntity = new SZEPCardEntry();
|
$szepCardEntity = new SZEPCardEntry();
|
||||||
$szepCardEntity->setHash($hash)
|
$szepCardEntity->setHash($hash)
|
||||||
->setAmount($amount)
|
->setAmount(intval($amount))
|
||||||
->setMerchant($merchant)
|
->setMerchant($merchant)
|
||||||
->setPocket($pocket)
|
->setPocket($pocket)
|
||||||
->setDate(new \DateTimeImmutable(str_replace(".", "-", $date)));
|
->setDate(new \DateTimeImmutable(str_replace(".", "-", $date)));
|
||||||
@ -150,7 +153,7 @@ class SZEPManagerService
|
|||||||
/** @var SZEPCardEntry $newRecord */
|
/** @var SZEPCardEntry $newRecord */
|
||||||
foreach ($newRecords as $newRecord) {
|
foreach ($newRecords as $newRecord) {
|
||||||
$resultCode = $this->koinService->saveTransaction(
|
$resultCode = $this->koinService->saveTransaction(
|
||||||
abs($newRecord->getAmount()),
|
(string)abs($newRecord->getAmount()),
|
||||||
'HUF',
|
'HUF',
|
||||||
$newRecord->getDate()->format("Y-m-d"),
|
$newRecord->getDate()->format("Y-m-d"),
|
||||||
$this->getCategory($newRecord),
|
$this->getCategory($newRecord),
|
||||||
@ -202,6 +205,8 @@ class SZEPManagerService
|
|||||||
$tags[] = 'Sushi';
|
$tags[] = 'Sushi';
|
||||||
} elseif (false !== strpos($SZEPCardEntry->getMerchant(), "Szentmihályi Uszoda")) {
|
} elseif (false !== strpos($SZEPCardEntry->getMerchant(), "Szentmihályi Uszoda")) {
|
||||||
$tags[] = 'Tope';
|
$tags[] = 'Tope';
|
||||||
|
} elseif (false !== strpos($SZEPCardEntry->getMerchant(), "BME Sportközpont")) {
|
||||||
|
$tags[] = 'BME Sportközpont';
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($SZEPCardEntry->getPocket()) {
|
switch ($SZEPCardEntry->getPocket()) {
|
||||||
@ -222,8 +227,8 @@ class SZEPManagerService
|
|||||||
*/
|
*/
|
||||||
private function encryptPayload(string $payload, $key = self::AES_KEY, $iv = self::IV_PARAM): string
|
private function encryptPayload(string $payload, $key = self::AES_KEY, $iv = self::IV_PARAM): string
|
||||||
{
|
{
|
||||||
$aesKeyString = call_user_func_array("pack", array_merge(array("c*"), $key));
|
$aesKeyString = call_user_func_array("pack", array_merge(["c*"], $key));
|
||||||
$ivParamStr = call_user_func_array("pack", array_merge(array("c*"), $iv));
|
$ivParamStr = call_user_func_array("pack", array_merge(["c*"], $iv));
|
||||||
return openssl_encrypt($payload, "AES-256-CBC", $aesKeyString, 0, $ivParamStr);
|
return openssl_encrypt($payload, "AES-256-CBC", $aesKeyString, 0, $ivParamStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager; // @phan-suppress-current-line PhanUnreferencedUseNormal
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Sms;
|
use App\Entity\Sms;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
@ -11,37 +11,46 @@ use Zend\EventManager\EventManager;
|
|||||||
|
|
||||||
class SmsStoreService
|
class SmsStoreService
|
||||||
{
|
{
|
||||||
/**
|
/** @var EntityManager */
|
||||||
* @var EntityManager
|
private $em;
|
||||||
*/
|
|
||||||
private $em;
|
|
||||||
|
|
||||||
public function __construct(EntityManager $em, EventManager $eventManager)
|
/** @var EventManager */
|
||||||
{
|
private $eventManager;
|
||||||
$this->em = $em;
|
|
||||||
$this->eventManager = $eventManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function storeSms(string $hashKey, int $direction, array $requestData): bool
|
public function __construct(EntityManager $em, EventManager $eventManager)
|
||||||
{
|
{
|
||||||
$normalizedDate = str_replace("at ", "", $requestData['when']);
|
$this->em = $em;
|
||||||
$user = $this->ensureUserExists($hashKey);
|
$this->eventManager = $eventManager;
|
||||||
$sms = new Sms();
|
}
|
||||||
$sms->setDirection($direction)
|
|
||||||
->setContactName($requestData['contactName'])
|
|
||||||
->setContactNumber($requestData['contactNumber'])
|
|
||||||
->setOccuredAt(new \DateTime($normalizedDate))
|
|
||||||
->setOwner($user)
|
|
||||||
->setText($requestData['text']);
|
|
||||||
$this->em->persist($sms);
|
|
||||||
$this->em->flush();
|
|
||||||
|
|
||||||
$this->eventManager->trigger('store.sms.persisted', $this, [
|
/**
|
||||||
'sms' => $sms,
|
* @param string $hashKey
|
||||||
]);
|
* @param int $direction
|
||||||
|
* @param array $requestData
|
||||||
|
* @return bool
|
||||||
|
* @throws \Doctrine\ORM\ORMException
|
||||||
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
|
*/
|
||||||
|
public function storeSms(string $hashKey, int $direction, array $requestData): bool
|
||||||
|
{
|
||||||
|
$normalizedDate = str_replace("at ", "", $requestData['when']);
|
||||||
|
$user = $this->ensureUserExists($hashKey);
|
||||||
|
$sms = new Sms();
|
||||||
|
$sms->setDirection($direction)
|
||||||
|
->setContactName($requestData['contactName'])
|
||||||
|
->setContactNumber($requestData['contactNumber'])
|
||||||
|
->setOccuredAt(new \DateTime($normalizedDate))
|
||||||
|
->setOwner($user)
|
||||||
|
->setText($requestData['text']);
|
||||||
|
$this->em->persist($sms);
|
||||||
|
$this->em->flush();
|
||||||
|
|
||||||
return true;
|
$this->eventManager->trigger('store.sms.persisted', $this, [
|
||||||
}
|
'sms' => $sms,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hashKey
|
* @param string $hashKey
|
||||||
@ -49,20 +58,20 @@ class SmsStoreService
|
|||||||
* @throws \Doctrine\ORM\ORMException
|
* @throws \Doctrine\ORM\ORMException
|
||||||
* @throws \Doctrine\ORM\OptimisticLockException
|
* @throws \Doctrine\ORM\OptimisticLockException
|
||||||
*/
|
*/
|
||||||
private function ensureUserExists(string $hashKey): User
|
private function ensureUserExists(string $hashKey): User
|
||||||
{
|
{
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->em->getRepository(User::class)->findOneBy([
|
$user = $this->em->getRepository(User::class)->findOneBy([
|
||||||
'hashKey' => $hashKey
|
'hashKey' => $hashKey
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if($user === null) {
|
if ($user === null) {
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->setHashKey($hashKey)->setName("Unknown");
|
$user->setHashKey($hashKey)->setName("Unknown");
|
||||||
$this->em->persist($user);
|
$this->em->persist($user);
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
|
||||||
use Interop\Container\ContainerInterface;
|
use Interop\Container\ContainerInterface;
|
||||||
use Zend\EventManager\EventManager;
|
use Zend\EventManager\EventManager;
|
||||||
|
|
||||||
|
|
||||||
class SmsStoreServiceFactory
|
class SmsStoreServiceFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user