Skip to content

Commit 7b7b497

Browse files
committed
init
1 parent 18dd2b8 commit 7b7b497

134 files changed

Lines changed: 7678 additions & 1 deletion

File tree

Some content is hidden

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

.gitignore

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

.scrutinizer.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
tools:
2+
external_code_coverage:
3+
timeout: 600
4+
php_code_sniffer: true
5+
php_cpd: true
6+
php_loc: true
7+
php_mess_detector: true
8+
php_pdepend: true
9+
php_analyzer: true
10+
sensiolabs_security_checker: true
11+
filter:
12+
paths: [src/*]

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
sudo: false
4+
5+
php:
6+
- 5.4
7+
- 5.5
8+
- 5.6
9+
- hhvm
10+
- nightly
11+
12+
before_script:
13+
- composer self-update
14+
- composer install --prefer-dist --no-interaction
15+
16+
script:
17+
- bin/phpunit --coverage-clover=coverage.clover --coverage-text
18+
19+
after_script:
20+
- wget https://scrutinizer-ci.com/ocular.phar
21+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Contributing
2+
============
3+
4+
If you are reading this, **thank you**! You are about to make things better and this makes you **a hero**!
5+
6+
Here are a few rules to follow in order to ease code reviews, and discussions before
7+
maintainers accept and merge your work.
8+
9+
You MUST follow the [PSR-1](http://www.php-fig.org/psr/1/) and
10+
[PSR-2](http://www.php-fig.org/psr/2/). If you don't know about any of them, you
11+
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
12+
tool](http://cs.sensiolabs.org/).
13+
14+
You MUST run the test suite.
15+
16+
You MUST write (or update) unit tests.
17+
18+
You SHOULD write documentation.
19+
20+
Please, write [commit messages that make
21+
sense](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
22+
and [rebase your branch](http://git-scm.com/book/en/Git-Branching-Rebasing)
23+
before submitting your Pull Request.
24+
25+
One may ask you to [squash your
26+
commits](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html)
27+
too. This is used to "clean" your Pull Request before merging it (we don't want
28+
commits such as `fix tests`, `fix 2`, `fix 3`, etc.).
29+
30+
Thank you very much!

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 Nicolò Pignatelli
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
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, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# valueobjects
1+
ValueObjects
2+
============
3+
4+
*nicolopignatelli/valueobjects*
5+
6+
Temporary substitute library

UPGRADE-3.0.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPGRADE FROM 2.x to 3.0
2+
=======================
3+
4+
### StringLiteral
5+
6+
* The `String` and `Null` classed and namespaces have been respectively renamed to
7+
`StringLiteral` and `NullValue` in order to be compatible with PHP 7.

composer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "ytake/valueobjects",
3+
"description": "A PHP library/collection of classes aimed to help developers using and undestanding immutable objects.(temporary package)",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Nicolò Pignatelli",
8+
"email": "pignatelli.nicolo@gmail.com"
9+
}
10+
],
11+
"require": {
12+
"php": ">=5.4",
13+
"ramsey/uuid": "~3.0",
14+
"mathiasverraes/money": "~1.2",
15+
"marc-mabe/php-enum": "~1.0",
16+
"zendframework/zend-validator": "~2.2",
17+
"league/geotools": "~0.7"
18+
},
19+
"require-dev": {
20+
"phpunit/phpunit": "~4.0"
21+
},
22+
"config": {
23+
"bin-dir": "bin"
24+
},
25+
"autoload": {
26+
"psr-4": {
27+
"ValueObjects\\": "src"
28+
}
29+
},
30+
"autoload-dev": {
31+
"psr-4": {
32+
"ValueObjects\\Tests\\": "tests/"
33+
}
34+
},
35+
"extra": {
36+
"branch-alias": {
37+
"dev-master": "4.2.x-dev"
38+
}
39+
},
40+
"replace": {
41+
"nicolopignatelli/valueobjects": "^4.0"
42+
}
43+
}

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
colors="true"
5+
convertErrorsToExceptions="true"
6+
convertNoticesToExceptions="true"
7+
convertWarningsToExceptions="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
syntaxCheck="false"
11+
bootstrap="vendor/autoload.php"
12+
>
13+
<testsuites>
14+
<testsuite name="valueobjects Test Suite">
15+
<directory>./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
<filter>
19+
<whitelist>
20+
<directory>./src/</directory>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

src/Climate/Celsius.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace ValueObjects\Climate;
4+
5+
class Celsius extends Temperature
6+
{
7+
/**
8+
* @return Celsius
9+
*/
10+
public function toCelsius()
11+
{
12+
return new static($this->value);
13+
}
14+
15+
/**
16+
* @return Kelvin
17+
*/
18+
public function toKelvin()
19+
{
20+
return new Kelvin($this->value + 273.15);
21+
}
22+
23+
/**
24+
* @return Fahrenheit
25+
*/
26+
public function toFahrenheit()
27+
{
28+
return new Fahrenheit($this->value * 1.8 + 32);
29+
}
30+
}

0 commit comments

Comments
 (0)