Skip to content
This repository was archived by the owner on Apr 10, 2020. It is now read-only.

Commit e0a298e

Browse files
committed
Initial commit
0 parents  commit e0a298e

81 files changed

Lines changed: 4638 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/tests export-ignore
2+
/.gitignore export-ignore
3+
/.travis.yml export-ignore
4+
/phpunit.xml export-ignore
5+
/phpcs.xml export-ignore
6+
/PULL_REQUEST_TEMPLATE.md export-ignore
7+
/CODE_OF_CONDUCT.md export-ignore
8+
/CONTRIBUTING.md export-ignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
/composer.lock

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: php
2+
php:
3+
- '7.2'
4+
- '7.3'
5+
6+
before_script:
7+
- composer install
8+
9+
script:
10+
- composer validate --strict
11+
- vendor/bin/phpunit --coverage-text
12+
- vendor/bin/phpcs src/ tests/
13+
14+
cache:
15+
directories:
16+
- $HOME/.composer/cache

CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## 1.0.0 - 2019-07-09
8+
### Added
9+
- `Ulrack\Validator\Common\ValidatorInterface`
10+
- `Ulrack\Validator\Component\Chain\AndValidator`
11+
- `Ulrack\Validator\Component\Chain\OneOfValidator`
12+
- `Ulrack\Validator\Component\Chain\OrValidator`
13+
- `Ulrack\Validator\Component\Iterable\ContainsValidator`
14+
- `Ulrack\Validator\Component\Iterable\ItemsValidator`
15+
- `Ulrack\Validator\Component\Iterable\MaxItemsValidator`
16+
- `Ulrack\Validator\Component\Iterable\MinItemsValidator`
17+
- `Ulrack\Validator\Component\Iterable\UniqueItemsValidator`
18+
- `Ulrack\Validator\Component\Logical\AlwaysValidator`
19+
- `Ulrack\Validator\Component\Logical\ConstValidator`
20+
- `Ulrack\Validator\Component\Logical\EnumValidator`
21+
- `Ulrack\Validator\Component\Logical\IfThenElseValidator`
22+
- `Ulrack\Validator\Component\Logical\NotValidator`
23+
- `Ulrack\Validator\Component\Numeric\ExclusiveMaximumValidator`
24+
- `Ulrack\Validator\Component\Numeric\ExclusiveMinimumValidator`
25+
- `Ulrack\Validator\Component\Numeric\MaximumValidator`
26+
- `Ulrack\Validator\Component\Numeric\MinimumValidator`
27+
- `Ulrack\Validator\Component\Numeric\MultipleOfValidator`
28+
- `Ulrack\Validator\Component\Object\DependencyValidator`
29+
- `Ulrack\Validator\Component\Object\MaxPropertiesValidator`
30+
- `Ulrack\Validator\Component\Object\MinPropertiesValidator`
31+
- `Ulrack\Validator\Component\Object\PropertiesValidator`
32+
- `Ulrack\Validator\Component\Object\RequiredValidator`
33+
- `Ulrack\Validator\Component\Textual\MaxLengthValidator`
34+
- `Ulrack\Validator\Component\Textual\MinLengthValidator`
35+
- `Ulrack\Validator\Component\Textual\PatternValidator`
36+
- `Ulrack\Validator\Component\Type\ArrayValidator`
37+
- `Ulrack\Validator\Component\Type\BooleanValidator`
38+
- `Ulrack\Validator\Component\Type\IntegerValidator`
39+
- `Ulrack\Validator\Component\Type\NullValidator`
40+
- `Ulrack\Validator\Component\Type\NumberValidator`
41+
- `Ulrack\Validator\Component\Type\ObjectValidator`
42+
- `Ulrack\Validator\Component\Type\StringValidator`
43+
- `Ulrack\Validator\Helper\DataPreparationHelper`
44+
45+
### Changed
46+
- Nothing
47+
48+
### Deprecated
49+
- Nothing
50+
51+
### Removed
52+
- Nothing
53+
54+
### Fixed
55+
- Nothing
56+
57+
### Security
58+
- Nothing
59+
60+
[Unreleased]: https://github.com/ulrack/validator/compare/1.0.0...HEAD

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at info@jyxon.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing
2+
3+
To contribute to this package, please keep to these guidelines.
4+
5+
- Fork the package.
6+
- Create a branch per feature.
7+
- Commit your changes to these branches.
8+
- Create a pull request per feature to the master branch of the original repository.
9+
10+
## Pull requests
11+
12+
Pull request should follow these rules, before they can get accepted.
13+
14+
- Follow the [pull request template](PULL_REQUEST_TEMPLATE.md).
15+
- Contains a short but complete description.
16+
- Has passed all test command listed bellow.
17+
18+
## Running Tests
19+
20+
``` bash
21+
$ vendor/bin/phpunit --coverage-text
22+
$ vendor/bin/phpcs src/ tests/
23+
```
24+
25+
## Notes
26+
27+
Multiple commits per feature are allowed, but please provide a good description in your pull request.
28+
This description will be used to squash your feature into the master branch.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Jyxon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# (bugfix / feature / refactor / etc.): Short descriptive title
2+
3+
## Description
4+
5+
Fixes #
6+
7+
Changes proposed in this pull request:
8+
-
9+
-
10+
-
11+
12+
Make sure you can check the following boxes before submitting the pull request:
13+
- [] The proposed changes work with the dependencies from composer.
14+
- [] The proposed changes have been thoroughly tested.
15+
- [] The proposed changes don't alter the code in such a manner that it conflicts with the initial purpose of the package.
16+
17+
Optional checkbox
18+
- [] Backwards incompatible

README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
[![Build Status](https://travis-ci.com/ulrack/validator.svg?branch=master)](https://travis-ci.com/ulrack/validator)
2+
3+
# Ulrack Validator
4+
5+
This package contains an interface and a handful of validators. These validators
6+
will validate a predetermined type of data against a single (or set of) rule(s).
7+
If the type does not match it will always return true.
8+
9+
## Installation
10+
11+
To install the package run the following command:
12+
13+
```
14+
composer require ulrack/validator
15+
```
16+
17+
## Usage
18+
19+
The validators are sorted by their type they will validate against.
20+
21+
### Chain
22+
23+
Chain validators are validators which verify the outcome of multiple nested
24+
validators against data and contain their own logic.
25+
26+
- [AndValidator](src/Component/Chain/AndValidator.php)
27+
- [OrValidator](src/Component/Chain/OrValidator.php)
28+
- [OneOfValidator](src/Component/Chain/OneOfValidator.php)
29+
30+
### Iterable
31+
32+
Iterable validators work with numeric arrays.
33+
34+
- [ContainsValidator](src/Component/Iterable/ContainsValidator.php)
35+
- [ItemsValidator](src/Component/Iterable/ItemsValidator.php)
36+
- [MaxItemsValidator](src/Component/Iterable/MaxItemsValidator.php)
37+
- [MinItemsValidator](src/Component/Iterable/MinItemsValidator.php)
38+
- [UniqueItemsValidator](src/Component/Iterable/UniqueItemsValidator.php)
39+
40+
### Logical
41+
42+
Logical validators are type independent logical validators.
43+
44+
- [AlwaysValidator](src/Component/Logical/AlwaysValidator.php)
45+
- [ConstValidator](src/Component/Logical/ConstValidator.php)
46+
- [EnumValidator](src/Component/Logical/EnumValidator.php)
47+
- [IfThenElseValidator](src/Component/Logical/IfThenElseValidator.php)
48+
- [NotValidator](src/Component/Logical/NotValidator.php)
49+
50+
### Numeric
51+
52+
Numeric validators work with numbers.
53+
54+
- [ExclusiveMaximumValidator](src/Component/Numeric/ExclusiveMaximumValidator.php)
55+
- [ExclusiveMinimumValidator](src/Component/Numeric/ExclusiveMinimumValidator.php)
56+
- [MaximumValidator](src/Component/Numeric/MaximumValidator.php)
57+
- [MinimumValidator](src/Component/Numeric/MinimumValidator.php)
58+
- [MultipleOfValidator](src/Component/Numeric/MultipleOfValidator.php)
59+
60+
### Object
61+
62+
Object validators verify the contents of objects.
63+
64+
- [DependencyValidator](src/Component/Object/DependencyValidator.php)
65+
- [MaxPropertiesValidator](src/Component/Object/MaxPropertiesValidator.php)
66+
- [MinPropertiesValidator](src/Component/Object/MinPropertiesValidator.php)
67+
- [PropertiesValidator](src/Component/Object/PropertiesValidator.php)
68+
- [RequiredValidator](src/Component/Object/RequiredValidator.php)
69+
70+
### Textual
71+
72+
Textual validators work with strings.
73+
74+
- [MaxLengthValidator](src/Component/Textual/MaxLengthValidator.php)
75+
- [MinLengthValidator](src/Component/Textual/MinLengthValidator.php)
76+
- [PatternValidator](src/Component/Textual/PatternValidator.php)
77+
78+
### Type
79+
80+
Type validators verify the type of the data. For example: whether the supplied
81+
data is of the type string, or integer.
82+
83+
- [ArrayValidator](src/Component/Type/ArrayValidator.php)
84+
- [BooleanValidator](src/Component/Type/BooleanValidator.php)
85+
- [IntegerValidator](src/Component/Type/IntegerValidator.php)
86+
- [NullValidator](src/Component/Type/NullValidator.php)
87+
- [NumberValidator](src/Component/Type/NumberValidator.php)
88+
- [ObjectValidator](src/Component/Type/ObjectValidator.php)
89+
- [StringValidator](src/Component/Type/StringValidator.php)
90+
91+
## Change log
92+
93+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
94+
95+
## Contributing
96+
97+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.
98+
99+
## MIT License
100+
101+
Copyright (c) 2019 Jyxon
102+
103+
Permission is hereby granted, free of charge, to any person obtaining a copy
104+
of this software and associated documentation files (the "Software"), to deal
105+
in the Software without restriction, including without limitation the rights
106+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
107+
copies of the Software, and to permit persons to whom the Software is
108+
furnished to do so, subject to the following conditions:
109+
110+
The above copyright notice and this permission notice shall be included in all
111+
copies or substantial portions of the Software.
112+
113+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
114+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
115+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
116+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
117+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
118+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
119+
SOFTWARE.

0 commit comments

Comments
 (0)