mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-13 01:51:50 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
787b8c697c | ||
|
|
96c02cdc3d | ||
|
|
87d7bff5f5 | ||
|
|
bd7c874e88 | ||
|
|
e1ffb78214 | ||
|
|
d4dc274763 | ||
|
|
aeea1df04b | ||
|
|
b5e63ff619 | ||
|
|
ecaebcca0e | ||
|
|
17ac1dc72c |
55
.gitignore
vendored
55
.gitignore
vendored
@@ -54,60 +54,9 @@
|
|||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------
|
||||||
### JetBrains template
|
### JetBrains
|
||||||
# ----------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
/.idea
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff:
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/dictionaries
|
|
||||||
.idea/vcs.xml
|
|
||||||
.idea/jsLibraryMappings.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files:
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.xml
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
|
|
||||||
# Gradle:
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-debug/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin:
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
## File-based project format:
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
## Plugin-specific files:
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
|||||||
Common Library (GitHub)
|
|
||||||
210
.idea/Common Library (GitHub).iml
generated
210
.idea/Common Library (GitHub).iml
generated
@@ -1,210 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests/Meritoo/Common/Tests" isTestSource="false" packagePrefix="Meritoo\Common\Tests\" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/Meritoo/Common" isTestSource="false" packagePrefix="Meritoo\Common\" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/behat/transliterator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/annotations" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/collections" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/common" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/friendsofphp/php-cs-fixer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/gecko-packages/gecko-php-unit" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/gedmo/doctrine-extensions" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/paragonie/random_compat" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/pdepend/pdepend" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phploc/phploc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpmd/phpmd" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/php-token-stream" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpunit/phpunit-mock-objects" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/diff" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/environment" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/finder-facade" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/git" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/phpcpd" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/resource-operations" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/version" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/squizlabs/php_codesniffer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/config" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/console" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/dependency-injection" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/filesystem" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/options-resolver" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php70" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/process" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/stopwatch" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/fdomdocument" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library name="PHP" type="php">
|
|
||||||
<CLASSES>
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/behat/transliterator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/composer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/annotations" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/collections" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/common" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/friendsofphp/php-cs-fixer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/gecko-packages/gecko-php-unit" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/gedmo/doctrine-extensions" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/paragonie/random_compat" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/pdepend/pdepend" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phploc/phploc" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpmd/phpmd" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-token-stream" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/phpunit-mock-objects" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/psr/container" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/psr/log" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/diff" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/environment" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/finder-facade" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/git" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/phpcpd" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/resource-operations" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/version" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/squizlabs/php_codesniffer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/config" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/dependency-injection" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/filesystem" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/options-resolver" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php70" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/process" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/stopwatch" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/theseer/fdomdocument" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
|
||||||
</CLASSES>
|
|
||||||
<SOURCES>
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/behat/transliterator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/composer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/annotations" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/collections" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/common" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/friendsofphp/php-cs-fixer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/gecko-packages/gecko-php-unit" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/gedmo/doctrine-extensions" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/myclabs/deep-copy" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/paragonie/random_compat" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/pdepend/pdepend" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phploc/phploc" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpmd/phpmd" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpspec/prophecy" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-code-coverage" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-file-iterator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-text-template" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-timer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/php-token-stream" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/phpunit" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/phpunit/phpunit-mock-objects" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/psr/container" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/psr/log" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/comparator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/diff" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/environment" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/exporter" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/finder-facade" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/git" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/global-state" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/object-enumerator" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/phpcpd" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/resource-operations" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/sebastian/version" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/squizlabs/php_codesniffer" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/config" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/dependency-injection" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/filesystem" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/options-resolver" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php70" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/process" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/stopwatch" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/yaml" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/theseer/fdomdocument" />
|
|
||||||
<root url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
|
||||||
</SOURCES>
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
9
.idea/composerJson.xml
generated
9
.idea/composerJson.xml
generated
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ComposerJsonPluginSettings">
|
|
||||||
<unboundedVersionInspectionSettings>
|
|
||||||
<excludedPackages />
|
|
||||||
</unboundedVersionInspectionSettings>
|
|
||||||
<customRepositories />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/encodings.xml
generated
6
.idea/encodings.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding">
|
|
||||||
<file url="PROJECT" charset="UTF-8" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/Common Library (GitHub).iml" filepath="$PROJECT_DIR$/.idea/Common Library (GitHub).iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
75
.idea/php.xml
generated
75
.idea/php.xml
generated
@@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="PhpIncludePathManager">
|
|
||||||
<include_path>
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/annotations" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/common" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/collections" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpspec/prophecy" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/config" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/stopwatch" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/behat/transliterator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php70" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/theseer/fdomdocument" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/debug" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/options-resolver" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-code-coverage" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/process" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/console" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-text-template" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-timer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit-mock-objects" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/gecko-packages/gecko-php-unit" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-token-stream" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/finder-facade" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/php-file-iterator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/git" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/exporter" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/code-unit-reverse-lookup" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/resource-operations" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/version" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/log" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/diff" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/environment" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/comparator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/global-state" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/dbal" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/container" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/object-enumerator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/recursion-context" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/friendsofphp/php-cs-fixer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpunit/phpunit" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/orm" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/pdepend/pdepend" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/sebastian/phpcpd" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phploc/phploc" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/squizlabs/php_codesniffer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpmd/phpmd" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/paragonie/random_compat" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/myclabs/deep-copy" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/gedmo/doctrine-extensions" />
|
|
||||||
</include_path>
|
|
||||||
</component>
|
|
||||||
<component name="PhpUnit">
|
|
||||||
<phpunit_settings>
|
|
||||||
<PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" phpunit_phar_path="" />
|
|
||||||
</phpunit_settings>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
14
.idea/webResources.xml
generated
14
.idea/webResources.xml
generated
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="WebResourcesPaths">
|
|
||||||
<contentEntries>
|
|
||||||
<entry url="file://$PROJECT_DIR$">
|
|
||||||
<entryData>
|
|
||||||
<resourceRoots>
|
|
||||||
<path value="file://$PROJECT_DIR$/data" />
|
|
||||||
</resourceRoots>
|
|
||||||
</entryData>
|
|
||||||
</entry>
|
|
||||||
</contentEntries>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
15
README.md
15
README.md
@@ -3,20 +3,7 @@ Useful classes, methods, extensions etc.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
#### Composer
|
Run [Composer](https://getcomposer.org) to install new package:
|
||||||
|
|
||||||
1. Open ```composer.json``` and add address of repository in ```repositories``` section:
|
|
||||||
|
|
||||||
```json
|
|
||||||
"repositories": [
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "git@github.com:meritoo/common-library.git"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Run [Composer](https://getcomposer.org) to install new package:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ composer require meritoo/common-library
|
$ composer require meritoo/common-library
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="Meritoo Common Library" basedir="." default="build:main" phingVersion="2.14.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
<if>
|
<if>
|
||||||
<available file="phing/properties" property="custom.properties.available"/>
|
<available file="phing/properties" property="custom.properties.available"/>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "meritoo/common-library",
|
"name": "meritoo/common-library",
|
||||||
"description": "Useful classes, methods, extensions etc.",
|
"description": "Useful classes, methods, extensions etc.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.0.1",
|
"version": "0.0.4",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Meritoo.pl",
|
"name": "Meritoo.pl",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="Meritoo Common Library" basedir="." default="build:main" phingVersion="2.14.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||||
<!-- Properties -->
|
<!-- Properties -->
|
||||||
<if>
|
<if>
|
||||||
<available file="phing/properties" property="custom.properties.available"/>
|
<available file="phing/properties" property="custom.properties.available"/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="Meritoo Common Library" basedir="." default="build:main" phingVersion="2.14.0">
|
<project name="Meritoo Package" basedir="." default="build:main" phingVersion="2.14.0">
|
||||||
<!--
|
<!--
|
||||||
The AutoloaderTask is required to load binaries installed by Composer.
|
The AutoloaderTask is required to load binaries installed by Composer.
|
||||||
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
||||||
|
|||||||
284
src/Meritoo/Common/Collection/Collection.php
Normal file
284
src/Meritoo/Common/Collection/Collection.php
Normal file
@@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Collection;
|
||||||
|
|
||||||
|
use ArrayAccess;
|
||||||
|
use ArrayIterator;
|
||||||
|
use Countable;
|
||||||
|
use IteratorAggregate;
|
||||||
|
use Meritoo\Common\Utilities\Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection of elements.
|
||||||
|
* It's a set of some elements, e.g. objects.
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*/
|
||||||
|
class Collection implements Countable, ArrayAccess, IteratorAggregate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The elements of collection
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $elements;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param array $elements (optional) The elements of collection
|
||||||
|
*/
|
||||||
|
public function __construct(array $elements = [])
|
||||||
|
{
|
||||||
|
$this->elements = $elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface Countable
|
||||||
|
*/
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
return count($this->elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface ArrayAccess
|
||||||
|
*/
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return $this->exists($offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface ArrayAccess
|
||||||
|
*/
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
if ($this->exists($offset)) {
|
||||||
|
return $this->elements[$offset];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface ArrayAccess
|
||||||
|
*/
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
$this->elements[$offset] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface ArrayAccess
|
||||||
|
*/
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
if ($this->exists($offset)) {
|
||||||
|
unset($this->elements[$offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
* Required by interface IteratorAggregate
|
||||||
|
*/
|
||||||
|
public function getIterator()
|
||||||
|
{
|
||||||
|
return new ArrayIterator($this->elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds given element (at the end of collection)
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to add
|
||||||
|
* @param mixed $index (optional) Index / key of the element
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function add($element, $index = null)
|
||||||
|
{
|
||||||
|
if ($index === null) {
|
||||||
|
$this->elements[] = $element;
|
||||||
|
} else {
|
||||||
|
$this->elements[$index] = $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds given elements (at the end of collection)
|
||||||
|
*
|
||||||
|
* @param array|Collection $elements The elements to add
|
||||||
|
* @param bool|false $useIndexes (optional) If is set to true, indexes of given elements will be used in
|
||||||
|
* this collection. Otherwise - not.
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function addMultiple($elements, $useIndexes = false)
|
||||||
|
{
|
||||||
|
if (!empty($elements)) {
|
||||||
|
foreach ($elements as $index => $element) {
|
||||||
|
if (!$useIndexes) {
|
||||||
|
$index = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->add($element, $index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepends given element (adds given element at the beginning of collection)
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to prepend
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function prepend($element)
|
||||||
|
{
|
||||||
|
array_unshift($this->elements, $element);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes given element
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to remove
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function remove($element)
|
||||||
|
{
|
||||||
|
if ($this->count() > 0) {
|
||||||
|
foreach ($this->elements as $index => $existing) {
|
||||||
|
if ($element === $existing) {
|
||||||
|
unset($this->elements[$index]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information if collection is empty
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isEmpty()
|
||||||
|
{
|
||||||
|
return empty($this->elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information if given element is first in the collection
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to verify
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isFirst($element)
|
||||||
|
{
|
||||||
|
return reset($this->elements) === $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information if given element is last in the collection
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to verify
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isLast($element)
|
||||||
|
{
|
||||||
|
return end($this->elements) === $element;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information if the collection has given element, iow. if given element exists in the collection
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to verify
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function has($element)
|
||||||
|
{
|
||||||
|
$index = Arrays::getIndexOf($this->elements, $element);
|
||||||
|
|
||||||
|
return $index !== null && $index !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns previous element for given element
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to verify
|
||||||
|
* @return mixed|null
|
||||||
|
*/
|
||||||
|
public function getPrevious($element)
|
||||||
|
{
|
||||||
|
return Arrays::getPreviousElement($this->elements, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns next element for given element
|
||||||
|
*
|
||||||
|
* @param mixed $element The element to verify
|
||||||
|
* @return mixed|null
|
||||||
|
*/
|
||||||
|
public function getNext($element)
|
||||||
|
{
|
||||||
|
return Arrays::getNextElement($this->elements, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first element in the collection
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getFirst()
|
||||||
|
{
|
||||||
|
return Arrays::getFirstElement($this->elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the last element in the collection
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLast()
|
||||||
|
{
|
||||||
|
return Arrays::getLastElement($this->elements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array representation of the collection
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray()
|
||||||
|
{
|
||||||
|
return $this->elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns information if element with given index/key exists
|
||||||
|
*
|
||||||
|
* @param string|int $index The index/key of element
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function exists($index)
|
||||||
|
{
|
||||||
|
return isset($this->elements[$index]) || array_key_exists($index, $this->elements);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception\Date;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An exception used while given part of date is incorrect, e.g. value of year is incorrect
|
|
||||||
*
|
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
|
||||||
* @copyright Meritoo.pl
|
|
||||||
*/
|
|
||||||
class IncorrectDatePartException extends Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Class constructor
|
|
||||||
*
|
|
||||||
* @param string $value Incorrect value
|
|
||||||
* @param string $datePart Type of date part, e.g. "year". One of \Meritoo\Common\Type\DatePartType class constants.
|
|
||||||
*/
|
|
||||||
public function __construct($value, $datePart)
|
|
||||||
{
|
|
||||||
$message = sprintf('Value of %s \'%s\' is incorrect. Is there everything ok?', $datePart, $value);
|
|
||||||
parent::__construct($message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Exception\Date;
|
||||||
|
|
||||||
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
|
use Meritoo\Common\Type\DatePartType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception used while type of date part, e.g. "year", is unknown
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*/
|
||||||
|
class UnknownDatePartTypeException extends UnknownTypeException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param string $unknownDatePart Type of date part, e.g. "year". One of DatePartType class constants.
|
||||||
|
* @param string $value Incorrect value
|
||||||
|
*/
|
||||||
|
public function __construct($unknownDatePart, $value)
|
||||||
|
{
|
||||||
|
parent::__construct($unknownDatePart, new DatePartType(), sprintf('date part (with value %s)', $value));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception;
|
namespace Meritoo\Common\Exception\Regex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exception used while length of given hexadecimal value of color is incorrect
|
* An exception used while length of given hexadecimal value of color is incorrect
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception;
|
namespace Meritoo\Common\Exception\Regex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exception used while given hexadecimal value of color is incorrect
|
* An exception used while given hexadecimal value of color is invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
@@ -19,11 +19,11 @@ class InvalidColorHexValueException extends \Exception
|
|||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*
|
*
|
||||||
* @param string $color Incorrect hexadecimal value of color
|
* @param string $color Invalid hexadecimal value of color
|
||||||
*/
|
*/
|
||||||
public function __construct($color)
|
public function __construct($color)
|
||||||
{
|
{
|
||||||
$message = sprintf('Hexadecimal value of color \'%s\' is incorrect. Is there everything ok?', $color);
|
$message = sprintf('Hexadecimal value of color \'%s\' is invalid. Is there everything ok?', $color);
|
||||||
parent::__construct($message);
|
parent::__construct($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
23
src/Meritoo/Common/Exception/Regex/InvalidUrlException.php
Normal file
23
src/Meritoo/Common/Exception/Regex/InvalidUrlException.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Exception\Regex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception used while url is invalid
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*/
|
||||||
|
class InvalidUrlException extends \Exception
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Class constructor
|
||||||
|
*
|
||||||
|
* @param string $url Invalid url
|
||||||
|
*/
|
||||||
|
public function __construct($url)
|
||||||
|
{
|
||||||
|
$message = sprintf('Url \'%s\' is invalid. Is there everything ok?', $url);
|
||||||
|
parent::__construct($message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Exception\Type;
|
||||||
|
|
||||||
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception used while the visibility of a property, a method or (as of PHP 7.1.0) a constant is unknown
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*/
|
||||||
|
class UnknownOopVisibilityTypeException extends UnknownTypeException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function __construct($unknownType)
|
||||||
|
{
|
||||||
|
parent::__construct($unknownType, new OopVisibilityType(), 'OOP-related visibility');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Type;
|
namespace Meritoo\Common\Type;
|
||||||
|
|
||||||
use Meritoo\Common\Type\Base\BaseType;
|
use Meritoo\Common\Type\Base\BaseType;
|
||||||
|
|||||||
37
src/Meritoo/Common/Type/OopVisibilityType.php
Normal file
37
src/Meritoo/Common/Type/OopVisibilityType.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Type;
|
||||||
|
|
||||||
|
use Meritoo\Common\Type\Base\BaseType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The visibility of a property, a method or (as of PHP 7.1.0) a constant
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*
|
||||||
|
* @see http://php.net/manual/en/language.oop5.visibility.php
|
||||||
|
*/
|
||||||
|
class OopVisibilityType extends BaseType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The "private" visibility of OOP
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const IS_PRIVATE = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "protected" visibility of OOP
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const IS_PROTECTED = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "public" visibility of OOP
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
const IS_PUBLIC = 1;
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ namespace Meritoo\Common\Utilities;
|
|||||||
|
|
||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Meritoo\Common\Exception\Date\IncorrectDatePartException;
|
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
||||||
use Meritoo\Common\Type\DatePartType;
|
use Meritoo\Common\Type\DatePartType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,7 +231,7 @@ class Date
|
|||||||
* @param int $day The day value
|
* @param int $day The day value
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
* @throws IncorrectDatePartException
|
* @throws UnknownDatePartTypeException
|
||||||
*/
|
*/
|
||||||
public static function getDayOfWeek($year, $month, $day)
|
public static function getDayOfWeek($year, $month, $day)
|
||||||
{
|
{
|
||||||
@@ -243,21 +243,21 @@ class Date
|
|||||||
* Oops, incorrect year
|
* Oops, incorrect year
|
||||||
*/
|
*/
|
||||||
if ($year <= 0) {
|
if ($year <= 0) {
|
||||||
throw new IncorrectDatePartException($year, DatePartType::YEAR);
|
throw new UnknownDatePartTypeException(DatePartType::YEAR, $year);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Oops, incorrect month
|
* Oops, incorrect month
|
||||||
*/
|
*/
|
||||||
if ($month < 1 || $month > 12) {
|
if ($month < 1 || $month > 12) {
|
||||||
throw new IncorrectDatePartException($month, DatePartType::MONTH);
|
throw new UnknownDatePartTypeException(DatePartType::MONTH, $month);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Oops, incorrect day
|
* Oops, incorrect day
|
||||||
*/
|
*/
|
||||||
if ($day < 1 || $day > 31) {
|
if ($day < 1 || $day > 31) {
|
||||||
throw new IncorrectDatePartException($day, DatePartType::DAY);
|
throw new UnknownDatePartTypeException(DatePartType::DAY, $day);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($month < 3) {
|
if ($month < 3) {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
namespace Meritoo\Common\Utilities;
|
namespace Meritoo\Common\Utilities;
|
||||||
|
|
||||||
use Meritoo\Common\Exception\IncorrectColorHexLengthException;
|
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
||||||
use Meritoo\Common\Exception\InvalidColorHexValueException;
|
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful regular expressions methods
|
* Useful regular expressions methods
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Utilities;
|
namespace Meritoo\Common\Utilities;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Generator;
|
use Generator;
|
||||||
|
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
use ReflectionClass;
|
||||||
|
use ReflectionMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case with common methods and data providers
|
* Test case with common methods and data providers
|
||||||
@@ -11,7 +22,7 @@ use Generator;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class TestCase extends \PHPUnit_Framework_TestCase
|
class TestCase extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Provides an empty value
|
* Provides an empty value
|
||||||
@@ -100,4 +111,89 @@ class TestCase extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
return sprintf('%s/../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
|
return sprintf('%s/../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies visibility and arguments of method
|
||||||
|
*
|
||||||
|
* @param string $classNamespace Namespace of class that contains method to verify
|
||||||
|
* @param string|ReflectionMethod $method Name of method or just the method to verify
|
||||||
|
* @param string $visibilityType Expected visibility of verified method. One of
|
||||||
|
* OopVisibilityType class constants.
|
||||||
|
* @param int $argumentsCount (optional) Expected count/amount of arguments of the
|
||||||
|
* verified method
|
||||||
|
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments
|
||||||
|
* of the verified method
|
||||||
|
* @throws UnknownOopVisibilityTypeException
|
||||||
|
*
|
||||||
|
* Attention. 2nd argument, the $method, may be:
|
||||||
|
* - string - name of the method
|
||||||
|
* - instance of ReflectionMethod - just the method (provided by ReflectionClass::getMethod() method)
|
||||||
|
*/
|
||||||
|
protected function verifyMethodVisibilityAndArguments(
|
||||||
|
$classNamespace,
|
||||||
|
$method,
|
||||||
|
$visibilityType,
|
||||||
|
$argumentsCount = 0,
|
||||||
|
$requiredArgumentsCount = 0
|
||||||
|
) {
|
||||||
|
/*
|
||||||
|
* Type of visibility is correct?
|
||||||
|
*/
|
||||||
|
if (!(new OopVisibilityType())->isCorrectType($visibilityType)) {
|
||||||
|
throw new UnknownOopVisibilityTypeException($visibilityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
$reflection = new ReflectionClass($classNamespace);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name of method provided only?
|
||||||
|
* Let's find instance of the method (based on reflection)
|
||||||
|
*/
|
||||||
|
if (!$method instanceof ReflectionMethod) {
|
||||||
|
$method = $reflection->getMethod($method);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($visibilityType) {
|
||||||
|
case OopVisibilityType::IS_PUBLIC:
|
||||||
|
static::assertTrue($method->isPublic());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OopVisibilityType::IS_PROTECTED:
|
||||||
|
static::assertTrue($method->isProtected());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OopVisibilityType::IS_PRIVATE:
|
||||||
|
static::assertTrue($method->isPrivate());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
static::assertEquals($argumentsCount, $method->getNumberOfParameters());
|
||||||
|
static::assertEquals($requiredArgumentsCount, $method->getNumberOfRequiredParameters());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies visibility and arguments of class constructor
|
||||||
|
*
|
||||||
|
* @param string $classNamespace Namespace of class that contains method to verify
|
||||||
|
* @param string $visibilityType Expected visibility of verified method. One of OopVisibilityType class
|
||||||
|
* constants.
|
||||||
|
* @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method
|
||||||
|
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments of the verified
|
||||||
|
* method
|
||||||
|
* @throws UnknownOopVisibilityTypeException
|
||||||
|
*/
|
||||||
|
protected function verifyConstructorVisibilityAndArguments(
|
||||||
|
$classNamespace,
|
||||||
|
$visibilityType,
|
||||||
|
$argumentsCount = 0,
|
||||||
|
$requiredArgumentsCount = 0
|
||||||
|
) {
|
||||||
|
/*
|
||||||
|
* Let's grab the constructor
|
||||||
|
*/
|
||||||
|
$reflection = new ReflectionClass($classNamespace);
|
||||||
|
$method = $reflection->getConstructor();
|
||||||
|
|
||||||
|
return $this->verifyMethodVisibilityAndArguments($classNamespace, $method, $visibilityType, $argumentsCount, $requiredArgumentsCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
329
tests/Meritoo/Common/Tests/Collection/CollectionTest.php
Normal file
329
tests/Meritoo/Common/Tests/Collection/CollectionTest.php
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Tests\Collection;
|
||||||
|
|
||||||
|
use ArrayIterator;
|
||||||
|
use Meritoo\Common\Collection\Collection;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
use Meritoo\Common\Utilities\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests of the collection of elements
|
||||||
|
*
|
||||||
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
|
* @copyright Meritoo.pl
|
||||||
|
*/
|
||||||
|
class CollectionTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* An empty collection
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
private $emptyCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple collection
|
||||||
|
*
|
||||||
|
* @var Collection
|
||||||
|
*/
|
||||||
|
private $simpleCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Elements of simple collection
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $simpleElements;
|
||||||
|
|
||||||
|
public function testEmptyCollection()
|
||||||
|
{
|
||||||
|
static::assertEquals(0, $this->emptyCollection->count());
|
||||||
|
static::assertCount(0, $this->emptyCollection);
|
||||||
|
static::assertEmpty($this->emptyCollection);
|
||||||
|
|
||||||
|
static::assertTrue($this->emptyCollection->isEmpty());
|
||||||
|
static::assertEquals([], $this->emptyCollection->toArray());
|
||||||
|
static::assertEmpty($this->emptyCollection->toArray());
|
||||||
|
|
||||||
|
static::assertNull($this->emptyCollection->getFirst());
|
||||||
|
static::assertNull($this->emptyCollection->getLast());
|
||||||
|
static::assertNull($this->emptyCollection[1]);
|
||||||
|
static::assertNull($this->emptyCollection['abc']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNotEmptyCollection()
|
||||||
|
{
|
||||||
|
static::assertEquals(4, $this->simpleCollection->count());
|
||||||
|
static::assertCount(4, $this->simpleCollection);
|
||||||
|
static::assertNotEmpty($this->simpleCollection);
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
static::assertEquals($this->simpleElements, $this->simpleCollection->toArray());
|
||||||
|
static::assertNotEmpty($this->simpleCollection->toArray());
|
||||||
|
|
||||||
|
static::assertEquals('lorem', $this->simpleCollection->getFirst());
|
||||||
|
static::assertEquals('sit', $this->simpleCollection->getLast());
|
||||||
|
static::assertEquals('dolor', $this->simpleCollection[123]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCount()
|
||||||
|
{
|
||||||
|
static::assertEquals(0, $this->emptyCollection->count());
|
||||||
|
static::assertEquals(4, $this->simpleCollection->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOffsetExists()
|
||||||
|
{
|
||||||
|
static::assertFalse(isset($this->emptyCollection['abc']));
|
||||||
|
static::assertFalse(isset($this->simpleCollection['abc']));
|
||||||
|
|
||||||
|
static::assertTrue(isset($this->simpleCollection[0]));
|
||||||
|
static::assertTrue(isset($this->simpleCollection[345]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOffsetGet()
|
||||||
|
{
|
||||||
|
static::assertNull($this->emptyCollection['abc']);
|
||||||
|
static::assertNull($this->simpleCollection['abc']);
|
||||||
|
|
||||||
|
static::assertEquals('lorem', $this->simpleCollection[0]);
|
||||||
|
static::assertEquals('sit', $this->simpleCollection[345]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOffsetSet()
|
||||||
|
{
|
||||||
|
$this->emptyCollection['test1'] = 1234;
|
||||||
|
$this->simpleCollection['test2'] = 5678;
|
||||||
|
|
||||||
|
static::assertTrue($this->emptyCollection->has(1234));
|
||||||
|
static::assertEquals(1234, $this->emptyCollection['test1']);
|
||||||
|
|
||||||
|
static::assertTrue($this->simpleCollection->has(5678));
|
||||||
|
static::assertEquals(5678, $this->simpleCollection['test2']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testOffsetUnset()
|
||||||
|
{
|
||||||
|
unset($this->simpleCollection[0]);
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->has('lorem'));
|
||||||
|
static::assertEquals('ipsum', $this->simpleCollection[1]);
|
||||||
|
static::assertEquals(3, $this->simpleCollection->count());
|
||||||
|
|
||||||
|
unset($this->simpleCollection[123]);
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->has('dolor'));
|
||||||
|
static::assertEquals('ipsum', $this->simpleCollection[1]);
|
||||||
|
static::assertEquals(2, $this->simpleCollection->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetIterator()
|
||||||
|
{
|
||||||
|
static::assertInstanceOf(ArrayIterator::class, $this->simpleCollection->getIterator());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAdd()
|
||||||
|
{
|
||||||
|
$this->emptyCollection->add('test1');
|
||||||
|
|
||||||
|
static::assertTrue($this->emptyCollection->has('test1'));
|
||||||
|
static::assertEquals(1, $this->emptyCollection->count());
|
||||||
|
static::assertEquals('test1', $this->emptyCollection[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddWithIndex()
|
||||||
|
{
|
||||||
|
$this->emptyCollection->add('test2', 1234);
|
||||||
|
|
||||||
|
static::assertTrue($this->emptyCollection->has('test2'));
|
||||||
|
static::assertEquals(1, $this->emptyCollection->count());
|
||||||
|
static::assertEquals('test2', $this->emptyCollection[1234]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddMultipleUsingEmptyArray()
|
||||||
|
{
|
||||||
|
$this->emptyCollection->addMultiple([]);
|
||||||
|
|
||||||
|
static::assertEquals(0, $this->emptyCollection->count());
|
||||||
|
static::assertTrue($this->emptyCollection->isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddMultiple()
|
||||||
|
{
|
||||||
|
$elements = [
|
||||||
|
'test1',
|
||||||
|
'test2',
|
||||||
|
1234 => 'test3',
|
||||||
|
5678 => 'test4',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->emptyCollection->addMultiple($elements);
|
||||||
|
|
||||||
|
static::assertFalse($this->emptyCollection->isEmpty());
|
||||||
|
static::assertEquals(4, $this->emptyCollection->count());
|
||||||
|
|
||||||
|
static::assertEquals('test1', $this->emptyCollection[0]);
|
||||||
|
static::assertEquals('test2', $this->emptyCollection[1]);
|
||||||
|
static::assertEquals('test3', $this->emptyCollection[2]);
|
||||||
|
static::assertEquals('test4', $this->emptyCollection[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testAddMultipleUsingIndexes()
|
||||||
|
{
|
||||||
|
$elements = [
|
||||||
|
'test1',
|
||||||
|
'test2',
|
||||||
|
1234 => 'test3',
|
||||||
|
5678 => 'test4',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->emptyCollection->addMultiple($elements, true);
|
||||||
|
|
||||||
|
static::assertFalse($this->emptyCollection->isEmpty());
|
||||||
|
static::assertEquals(4, $this->emptyCollection->count());
|
||||||
|
|
||||||
|
static::assertEquals('test1', $this->emptyCollection[0]);
|
||||||
|
static::assertEquals('test2', $this->emptyCollection[1]);
|
||||||
|
static::assertEquals('test3', $this->emptyCollection[1234]);
|
||||||
|
static::assertEquals('test4', $this->emptyCollection[5678]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPrepend()
|
||||||
|
{
|
||||||
|
$this->emptyCollection->prepend('lorem-ipsum');
|
||||||
|
|
||||||
|
static::assertFalse($this->emptyCollection->isEmpty());
|
||||||
|
static::assertEquals(1, $this->emptyCollection->count());
|
||||||
|
static::assertEquals('lorem-ipsum', $this->emptyCollection[0]);
|
||||||
|
|
||||||
|
$this->simpleCollection->prepend('lorem-ipsum');
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
static::assertEquals(5, $this->simpleCollection->count());
|
||||||
|
static::assertEquals('lorem-ipsum', $this->simpleCollection[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRemoveNotExistingElement()
|
||||||
|
{
|
||||||
|
$this->emptyCollection->remove('abc');
|
||||||
|
|
||||||
|
static::assertTrue($this->emptyCollection->isEmpty());
|
||||||
|
static::assertEquals(0, $this->emptyCollection->count());
|
||||||
|
|
||||||
|
$this->simpleCollection->remove('abc');
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
static::assertEquals(4, $this->simpleCollection->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRemove()
|
||||||
|
{
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
static::assertEquals(4, $this->simpleCollection->count());
|
||||||
|
static::assertEquals('ipsum', $this->simpleCollection[1]);
|
||||||
|
|
||||||
|
$this->simpleCollection->remove('ipsum');
|
||||||
|
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
static::assertEquals(3, $this->simpleCollection->count());
|
||||||
|
static::assertNull($this->simpleCollection[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsEmpty()
|
||||||
|
{
|
||||||
|
static::assertTrue($this->emptyCollection->isEmpty());
|
||||||
|
static::assertFalse($this->simpleCollection->isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsFirst()
|
||||||
|
{
|
||||||
|
static::assertFalse($this->emptyCollection->isFirst('abc'));
|
||||||
|
static::assertFalse($this->simpleCollection->isFirst('abc'));
|
||||||
|
static::assertFalse($this->simpleCollection->isFirst('dolor'));
|
||||||
|
static::assertTrue($this->simpleCollection->isFirst('lorem'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIsLast()
|
||||||
|
{
|
||||||
|
static::assertFalse($this->emptyCollection->isLast('abc'));
|
||||||
|
static::assertFalse($this->simpleCollection->isLast('abc'));
|
||||||
|
static::assertFalse($this->simpleCollection->isLast('dolor'));
|
||||||
|
static::assertTrue($this->simpleCollection->isLast('sit'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHas()
|
||||||
|
{
|
||||||
|
static::assertFalse($this->emptyCollection->has('abc'));
|
||||||
|
static::assertFalse($this->simpleCollection->has('abc'));
|
||||||
|
static::assertTrue($this->simpleCollection->has('lorem'));
|
||||||
|
static::assertTrue($this->simpleCollection->has('dolor'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetPrevious()
|
||||||
|
{
|
||||||
|
static::assertNull($this->emptyCollection->getPrevious('abc'));
|
||||||
|
static::assertNull($this->simpleCollection->getPrevious('abc'));
|
||||||
|
static::assertNull($this->simpleCollection->getPrevious('lorem'));
|
||||||
|
|
||||||
|
static::assertEquals('lorem', $this->simpleCollection->getPrevious('ipsum'));
|
||||||
|
static::assertEquals('dolor', $this->simpleCollection->getPrevious('sit'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetNext()
|
||||||
|
{
|
||||||
|
static::assertNull($this->emptyCollection->getNext('abc'));
|
||||||
|
static::assertNull($this->simpleCollection->getNext('abc'));
|
||||||
|
static::assertNull($this->simpleCollection->getNext('sit'));
|
||||||
|
|
||||||
|
static::assertEquals('dolor', $this->simpleCollection->getNext('ipsum'));
|
||||||
|
static::assertEquals('sit', $this->simpleCollection->getNext('dolor'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetFirst()
|
||||||
|
{
|
||||||
|
static::assertNull($this->emptyCollection->getFirst());
|
||||||
|
static::assertEquals('lorem', $this->simpleCollection->getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetLast()
|
||||||
|
{
|
||||||
|
static::assertNull($this->emptyCollection->getLast());
|
||||||
|
static::assertEquals('sit', $this->simpleCollection->getLast());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testToArray()
|
||||||
|
{
|
||||||
|
static::assertEquals([], $this->emptyCollection->toArray());
|
||||||
|
static::assertEquals($this->simpleElements, $this->simpleCollection->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExistsVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
$this->verifyMethodVisibilityAndArguments(Collection::class, 'exists', OopVisibilityType::IS_PRIVATE, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->simpleElements = [
|
||||||
|
'lorem',
|
||||||
|
'ipsum',
|
||||||
|
123 => 'dolor',
|
||||||
|
345 => 'sit',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->emptyCollection = new Collection();
|
||||||
|
$this->simpleCollection = new Collection($this->simpleElements);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ namespace Meritoo\Common\Tests\Exception\Base;
|
|||||||
|
|
||||||
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
use Meritoo\Common\Type\Base\BaseType;
|
use Meritoo\Common\Type\Base\BaseType;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of the exception used while type of something is unknown
|
* Tests of the exception used while type of something is unknown
|
||||||
@@ -17,7 +18,7 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class UnknownTypeExceptionTest extends \PHPUnit_Framework_TestCase
|
class UnknownTypeExceptionTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testWithoutException()
|
public function testWithoutException()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Meritoo\Common\Tests\Type\Base;
|
|||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Type\Base\BaseType;
|
use Meritoo\Common\Type\Base\BaseType;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of the base / abstract type of something
|
* Tests of the base / abstract type of something
|
||||||
@@ -17,7 +18,7 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class BaseTypeTest extends \PHPUnit_Framework_TestCase
|
class BaseTypeTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param BaseType $type Type of something
|
* @param BaseType $type Type of something
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Meritoo\Common\Tests\Type;
|
|||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Type\DatePartType;
|
use Meritoo\Common\Type\DatePartType;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of the type of date part, e.g. "year"
|
* Tests of the type of date part, e.g. "year"
|
||||||
@@ -17,7 +18,7 @@ use Meritoo\Common\Type\DatePartType;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class DatePartTypeTest extends \PHPUnit_Framework_TestCase
|
class DatePartTypeTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetAll()
|
public function testGetAll()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
namespace Meritoo\Common\Tests\Utilities;
|
namespace Meritoo\Common\Tests\Utilities;
|
||||||
|
|
||||||
use Meritoo\Common\Utilities\Arrays;
|
use Meritoo\Common\Utilities\Arrays;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of the useful arrays methods
|
* Tests of the useful arrays methods
|
||||||
@@ -16,7 +17,7 @@ use Meritoo\Common\Utilities\Arrays;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class ArraysTest extends \PHPUnit_Framework_TestCase
|
class ArraysTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $simpleArray;
|
private $simpleArray;
|
||||||
private $simpleArrayWithKeys;
|
private $simpleArrayWithKeys;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
namespace Meritoo\Common\Tests\Utilities;
|
namespace Meritoo\Common\Tests\Utilities;
|
||||||
|
|
||||||
use Meritoo\Common\Utilities\Bundle;
|
use Meritoo\Common\Utilities\Bundle;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests of the useful methods for bundle
|
* Tests of the useful methods for bundle
|
||||||
@@ -16,7 +17,7 @@ use Meritoo\Common\Utilities\Bundle;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class BundleTest extends \PHPUnit_Framework_TestCase
|
class BundleTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetBundleViewPathEmptyPathAndBundle()
|
public function testGetBundleViewPathEmptyPathAndBundle()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities;
|
namespace Meritoo\Common\Tests\Utilities;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Generator;
|
use Generator;
|
||||||
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
use Meritoo\Common\Utilities\DatePeriod;
|
use Meritoo\Common\Utilities\DatePeriod;
|
||||||
use Meritoo\Common\Utilities\TestCase;
|
use Meritoo\Common\Utilities\TestCase;
|
||||||
|
|
||||||
@@ -15,6 +22,11 @@ use Meritoo\Common\Utilities\TestCase;
|
|||||||
*/
|
*/
|
||||||
class DatePeriodTest extends TestCase
|
class DatePeriodTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public function testConstructorVisibilityAndArguments()
|
||||||
|
{
|
||||||
|
$this->verifyConstructorVisibilityAndArguments(DatePeriod::class, OopVisibilityType::IS_PUBLIC, 2, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DateTime $startDate (optional) Start date of period
|
* @param DateTime $startDate (optional) Start date of period
|
||||||
* @param DateTime $endDate (optional) End date of period
|
* @param DateTime $endDate (optional) End date of period
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Meritoo\Common\Tests\Utilities;
|
|||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Date\IncorrectDatePartException;
|
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
||||||
use Meritoo\Common\Utilities\Date;
|
use Meritoo\Common\Utilities\Date;
|
||||||
use Meritoo\Common\Utilities\TestCase;
|
use Meritoo\Common\Utilities\TestCase;
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ class DateTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testGetDayOfWeekIncorrectValues($year, $month, $day)
|
public function testGetDayOfWeekIncorrectValues($year, $month, $day)
|
||||||
{
|
{
|
||||||
$this->expectException(IncorrectDatePartException::class);
|
$this->expectException(UnknownDatePartTypeException::class);
|
||||||
self::assertEmpty(Date::getDayOfWeek($year, $month, $day));
|
self::assertEmpty(Date::getDayOfWeek($year, $month, $day));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
namespace Meritoo\Common\Tests\Utilities;
|
namespace Meritoo\Common\Tests\Utilities;
|
||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\IncorrectColorHexLengthException;
|
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
||||||
use Meritoo\Common\Exception\InvalidColorHexValueException;
|
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||||
use Meritoo\Common\Utilities\Locale;
|
use Meritoo\Common\Utilities\Locale;
|
||||||
use Meritoo\Common\Utilities\Miscellaneous;
|
use Meritoo\Common\Utilities\Miscellaneous;
|
||||||
use Meritoo\Common\Utilities\TestCase;
|
use Meritoo\Common\Utilities\TestCase;
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
namespace Meritoo\Common\Tests\Utilities\Reflection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
namespace Meritoo\Common\Tests\Utilities;
|
namespace Meritoo\Common\Tests\Utilities;
|
||||||
|
|
||||||
use Meritoo\Common\Utilities\Xml;
|
use Meritoo\Common\Utilities\Xml;
|
||||||
|
use PHPUnit_Framework_TestCase;
|
||||||
use SimpleXMLElement;
|
use SimpleXMLElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -17,7 +18,7 @@ use SimpleXMLElement;
|
|||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo.pl
|
||||||
*/
|
*/
|
||||||
class XmlTest extends \PHPUnit_Framework_TestCase
|
class XmlTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
private $simpleXml;
|
private $simpleXml;
|
||||||
private $advancedXml;
|
private $advancedXml;
|
||||||
|
|||||||
Reference in New Issue
Block a user