diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d116b27 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +Contributing +============ + +Issues +------ + +An issue will be **automatically** close without a test case failing. + +Pull-Request +------------ + +Any Pull-Request **MUST** have following parts: + +1. Test case for new feature or bugfix +2. Reference documentation updated in case of new feature +3. Code update + +Otherwise it may be refuse. + +Please also specify following in the description: + +* Bugfix ? +* New feature ? +* [BC Break](http://stackoverflow.com/questions/8891005/what-does-bc-break-mean) ? + +Thanks! diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..3d7cf52 --- /dev/null +++ b/LICENCE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Nekland + +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. diff --git a/README.md b/README.md index 042a8d6..5aff196 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,75 @@ Nekland Tools ============= +[![Build Status](https://travis-ci.org/Nekland/Tools.svg?branch=master)](https://travis-ci.org/Nekland/Tools) + Just some classes helping to code with PHP in general. +**This repository follows semver.** Installation ------------ -Inside your `composer.json` file: - -```json -{ - "require": { - "nekland/tools": "dev-master" - }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/Nekland/Tools" - } - ] -} +```bash +composer require "nekland/tools" +``` + +Reference +--------- + +### StrinTools class + +**Encoding arguments are optionals.** + +#### ::camelize + +```php +StringTools::camelize($str, $from) : string ``` -Then `composer update nekland/tools`. +* `$str` string input +* `$from` (optional, default "\_") string entry format (can be "-" or "\_") + +#### ::startsWith + +```php +StringTools::startsWith($str, $start, $encoding) : bool +``` + +* `$str` string input +* `$start` string it should starts with + +#### ::endsWith + +```php +StringTools::endsWith($str, $end, $encoding) : bool +``` + +* `$str` string input +* `$end` string it should ends with + +#### ::removeStart + +```php +StringTools::removeStart($str, $toRemove, $encoding) : string +``` + +* `$str` string input +* `$toRemove` string to remove at the start of `$str` + +#### ::contains + +```php +StringTools::contains($str, $needle, $encoding) : bool +``` + +* `$str` string input +* `$needle` potentially contained string + +### EqualableInterface + +Helps you equals on objects on a similar way as [java](http://stackoverflow.com/questions/1643067/whats-the-difference-between-equals-and). + +#### equals + +Method that you must implements to check if the object taking as parameter is equals or not.