This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5f0e346
Showing
17 changed files
with
615 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/tests export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml export-ignore | ||
/phpcs.xml export-ignore | ||
/PULL_REQUEST_TEMPLATE.md export-ignore | ||
/CODE_OF_CONDUCT.md export-ignore | ||
/CONTRIBUTING.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor | ||
/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: php | ||
php: | ||
- '7.2' | ||
- '7.3' | ||
|
||
before_script: | ||
- composer install | ||
|
||
script: | ||
- composer validate --strict | ||
- vendor/bin/phpunit --coverage-text | ||
- vendor/bin/phpcs src/ tests/ | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## 1.0.0 - 2019-07-17 | ||
### Added | ||
- `Ulrack\Storage\Common\StorageInterface` | ||
- `Ulrack\Storage\Component\ObjectStorage` | ||
- `Ulrack\Storage\Exception\StorageException` | ||
- `Ulrack\Storage\Exception\DataNotFoundException` | ||
- Unit test. | ||
|
||
### Changed | ||
- Nothing | ||
|
||
### Deprecated | ||
- Nothing | ||
|
||
### Removed | ||
- Nothing | ||
|
||
### Fixed | ||
- Nothing | ||
|
||
### Security | ||
- Nothing | ||
|
||
[Unreleased]: https://github.com/ulrack/storage/compare/1.0.0...HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at info@jyxon.com. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Contributing | ||
|
||
To contribute to this package, please keep to these guidelines. | ||
|
||
- Fork the package. | ||
- Create a branch per feature. | ||
- Commit your changes to these branches. | ||
- Create a pull request per feature to the master branch of the original repository. | ||
|
||
## Pull requests | ||
|
||
Pull request should follow these rules, before they can get accepted. | ||
|
||
- Follow the [pull request template](PULL_REQUEST_TEMPLATE.md). | ||
- Contains a short but complete description. | ||
- Has passed all test command listed bellow. | ||
|
||
## Running Tests | ||
|
||
``` bash | ||
$ vendor/bin/phpunit --coverage-text | ||
$ vendor/bin/phpcs src/ tests/ | ||
``` | ||
|
||
## Notes | ||
|
||
Multiple commits per feature are allowed, but please provide a good description in your pull request. | ||
This description will be used to squash your feature into the master branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Jyxon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# (bugfix / feature / refactor / etc.): Short descriptive title | ||
|
||
## Description | ||
|
||
Fixes # | ||
|
||
Changes proposed in this pull request: | ||
- | ||
- | ||
- | ||
|
||
Make sure you can check the following boxes before submitting the pull request: | ||
- [] The proposed changes work with the dependencies from composer. | ||
- [] The proposed changes have been thoroughly tested. | ||
- [] The proposed changes don't alter the code in such a manner that it conflicts with the initial purpose of the package. | ||
|
||
Optional checkbox | ||
- [] Backwards incompatible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[![Build Status](https://travis-ci.com/ulrack/storage.svg?branch=master)](https://travis-ci.com/ulrack/storage) | ||
|
||
# Ulrack Storage | ||
|
||
This package provides an interface and a simple implementation of a storage. | ||
Storages are meant to be simple Data Access Objects (DAO's). | ||
The implementation that is provided with this package stores data on the object. | ||
|
||
## Installation | ||
|
||
To install the package run the following command: | ||
|
||
``` | ||
composer require ulrack/storage | ||
``` | ||
|
||
## Usage | ||
|
||
The [interface](src/Common/StorageInterface.php) provides a flexible contract for | ||
applications. The StorageInterface could also be easily implemented with an | ||
adapter for example, with a filesystem or a database. | ||
|
||
The [provided implementation](src/Component/ObjectStorage.php) is a simple | ||
object with a data variable containing all data. This could be used for storing | ||
and sharing data between objects. | ||
|
||
## Change log | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details. | ||
|
||
## MIT License | ||
|
||
Copyright (c) 2019 Jyxon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "ulrack/storage", | ||
"description": "Storage interfacing for Ulrack.", | ||
"keywords": ["storage"], | ||
"type": "library", | ||
"license": "MIT", | ||
"prefer-stable": true, | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": "^7.2" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Ulrack", | ||
"homepage": "https://www.ulrack.com/", | ||
"role": "Developer" | ||
} | ||
], | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Ulrack\\Storage\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Ulrack\\Storage\\Tests\\": "tests/" | ||
} | ||
}, | ||
"archive": { | ||
"exclude": [ | ||
"/tests", | ||
"/.gitignore", | ||
"/.travis.yml", | ||
"/phpunit.xml", | ||
"/phpcs.xml", | ||
"/PULL_REQUEST_TEMPLATE.md", | ||
"/CODE_OF_CONDUCT.md", | ||
"/CONTRIBUTING.md" | ||
] | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^8.0", | ||
"squizlabs/php_codesniffer": "^3.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="ulrack"> | ||
<arg value="p" /> | ||
|
||
<config name="ignore_warnings_on_exit" value="1" /> | ||
<config name="ignore_errors_on_exit" value="1" /> | ||
|
||
<arg name="colors" /> | ||
<arg value="s" /> | ||
|
||
<!-- Use the PSR2 Standard--> | ||
<rule ref="PSR2" /> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
cacheResult="false"> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Copyright (C) Jyxon, Inc. All rights reserved. | ||
* See LICENSE for license details. | ||
*/ | ||
namespace Ulrack\Storage\Common; | ||
|
||
use ArrayAccess; | ||
use Traversable; | ||
|
||
interface StorageInterface extends ArrayAccess, Traversable | ||
{ | ||
/** | ||
* Gets data from a specific key within the storage. | ||
* | ||
* @param string|int $key | ||
* | ||
* @return mixed | ||
*/ | ||
public function get($key); | ||
|
||
/** | ||
* Sets data on a specific key within the storage. | ||
* | ||
* @param string|int $key | ||
* @param mixed $data | ||
* | ||
* @return void | ||
*/ | ||
public function set($key, $data): void; | ||
|
||
/** | ||
* Removes data from a key within a storage. | ||
* | ||
* @param string|int $key | ||
* | ||
* @return void | ||
*/ | ||
public function unset($key): void; | ||
|
||
/** | ||
* Checks whether the storage has data on this key. | ||
* | ||
* @param string|int $key | ||
* | ||
* @return bool | ||
*/ | ||
public function has($key): bool; | ||
|
||
/** | ||
* Retrieves an array of keys from the storage. | ||
* | ||
* @return string[]|int[] | ||
*/ | ||
public function keys(): array; | ||
} |
Oops, something went wrong.