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
Michael Pratt
committed
Sep 23, 2013
0 parents
commit 594e2c6
Showing
18 changed files
with
982 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,6 @@ | ||
.DS_Store | ||
vendor/* | ||
Docs/* | ||
Tests/Coverage | ||
composer.lock | ||
composer.phar |
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,25 @@ | ||
filter: | ||
excluded_paths: | ||
- 'vendor/*' | ||
- 'Tests/*' | ||
paths: | ||
- Lib/ | ||
tools: | ||
php_cpd: | ||
filter: | ||
excluded_paths: ['vendor/*', 'Tests/*'] | ||
php_pdepend: | ||
excluded_dirs: | ||
1: 'Tests/*' | ||
php_mess_detector: | ||
filter: | ||
excluded_paths: ['vendor/*', 'Tests/*'] | ||
sensiolabs_security_checker: | ||
filter: | ||
excluded_paths: ['vendor/*', 'Tests/*'] | ||
php_code_coverage: | ||
filter: | ||
excluded_paths: ['vendor/*', 'Tests/*'] | ||
php_loc: | ||
excluded_dirs: | ||
- 'Tests/*' |
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,6 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 |
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,20 @@ | ||
MIT LICENSE | ||
Copyright (C) 2013 by Michael Pratt <pratt@hablarmierda.net> | ||
|
||
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,72 @@ | ||
<?php | ||
/** | ||
* Language.php | ||
* | ||
* @author Michael Pratt <pratt@hablarmierda.net> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace RelativeTime\Adapters; | ||
|
||
/** | ||
* Abstract class for language definitions. | ||
* It basically gives the option to use an object | ||
* as as an array. | ||
*/ | ||
abstract class Language implements \ArrayAccess | ||
{ | ||
protected $strings = array(); | ||
|
||
/** | ||
* Sets a parameter | ||
* | ||
* @param string $id | ||
* @param string $value | ||
*/ | ||
public function offsetSet($id, $value) { $this->strings[$id] = $value; } | ||
|
||
/** | ||
* Gets a parameter | ||
* | ||
* @param string $id | ||
* @return string | ||
* | ||
* @throws InvalidArgumentException if the id is not defined | ||
*/ | ||
public function offsetGet($id) | ||
{ | ||
if (!array_key_exists($id, $this->strings)) | ||
throw new \InvalidArgumentException($id . ' is not defined'); | ||
|
||
return $this->strings[$id]; | ||
} | ||
|
||
/** | ||
* Checks if a parameter is set. | ||
* | ||
* @param string $id | ||
* @return bool | ||
*/ | ||
public function offsetExists($id) { return array_key_exists($id, $this->strings); } | ||
|
||
/** | ||
* Unsets a parameter | ||
* | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function offsetUnset($id) { unset($this->strings[$id]); } | ||
|
||
/** | ||
* Returns all defined keys | ||
* | ||
* @return array | ||
*/ | ||
public function keys() { return array_keys($this->strings); } | ||
} | ||
|
||
?> |
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,22 @@ | ||
<?php | ||
/** | ||
* Autoload.php | ||
* The RelativeTime Autoloader, to be used when there is no composer around. | ||
* | ||
* @author Michael Pratt <pratt@hablarmierda.net> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
if (function_exists('spl_autoload_register')) | ||
{ | ||
spl_autoload_register(function ($class) { | ||
$class = __DIR__ . '/' . str_replace('\\', DIRECTORY_SEPARATOR, str_ireplace('RelativeTime\\', '', $class)) . '.php'; | ||
if (file_exists($class)) | ||
require $class; | ||
}); | ||
} | ||
|
||
?> |
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,51 @@ | ||
<?php | ||
/** | ||
* English.php | ||
* | ||
* @author Michael Pratt <pratt@hablarmierda.net> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace RelativeTime\Languages; | ||
|
||
/** | ||
* English Translation | ||
*/ | ||
class English extends \RelativeTime\Adapters\Language | ||
{ | ||
protected $strings = array( | ||
'now' => 'just now', | ||
'ago' => '%s ago', | ||
'left' => '%s left', | ||
'seconds' => array( | ||
'plural' => '%d seconds', | ||
'singular' => '%d second', | ||
), | ||
'minutes' => array( | ||
'plural' => '%d minutes', | ||
'singular' => '%d minute', | ||
), | ||
'hours' => array( | ||
'plural' => '%d hours', | ||
'singular' => '%d hour', | ||
), | ||
'days' => array( | ||
'plural' => '%d days', | ||
'singular' => '%d day', | ||
), | ||
'months' => array( | ||
'plural' => '%d months', | ||
'singular' => '%d month', | ||
), | ||
'years' => array( | ||
'plural' => '%d years', | ||
'singular' => '%d year', | ||
), | ||
); | ||
} | ||
|
||
?> |
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,51 @@ | ||
<?php | ||
/** | ||
* German.php | ||
* | ||
* @author Michael Pratt <pratt@hablarmierda.net> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace RelativeTime\Languages; | ||
|
||
/** | ||
* German Translation | ||
*/ | ||
class German extends \RelativeTime\Adapters\Language | ||
{ | ||
protected $strings = array( | ||
'now' => 'just now', | ||
'ago' => 'vor %s', | ||
'left' => '%s nach', | ||
'seconds' => array( | ||
'plural' => '%d Sekunden', | ||
'singular' => '%d Sekunde', | ||
), | ||
'minutes' => array( | ||
'plural' => '%d Minuten', | ||
'singular' => '%d Minute', | ||
), | ||
'hours' => array( | ||
'plural' => '%d Stunden', | ||
'singular' => '%d Stunde', | ||
), | ||
'days' => array( | ||
'plural' => '%d Tage', | ||
'singular' => '%d Tag', | ||
), | ||
'months' => array( | ||
'plural' => '%d Monaten', | ||
'singular' => '%d Monat', | ||
), | ||
'years' => array( | ||
'plural' => '%d Jahren', | ||
'singular' => '%d Jahr', | ||
), | ||
); | ||
} | ||
|
||
?> |
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,51 @@ | ||
<?php | ||
/** | ||
* Spanish.php | ||
* | ||
* @author Michael Pratt <pratt@hablarmierda.net> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace RelativeTime\Languages; | ||
|
||
/** | ||
* Spanish Translation | ||
*/ | ||
class Spanish extends \RelativeTime\Adapters\Language | ||
{ | ||
protected $strings = array( | ||
'now' => 'justo ahora', | ||
'ago' => 'hace %s', | ||
'left' => 'faltan %s', | ||
'seconds' => array( | ||
'plural' => '%d segundos', | ||
'singular' => '%d segundo', | ||
), | ||
'minutes' => array( | ||
'plural' => '%d minutos', | ||
'singular' => '%d minuto', | ||
), | ||
'hours' => array( | ||
'plural' => '%d horas', | ||
'singular' => '%d hora', | ||
), | ||
'days' => array( | ||
'plural' => '%d dias', | ||
'singular' => '%d dia', | ||
), | ||
'months' => array( | ||
'plural' => '%d meses', | ||
'singular' => '%d mes', | ||
), | ||
'years' => array( | ||
'plural' => '%d años', | ||
'singular' => '%d año', | ||
), | ||
); | ||
} | ||
|
||
?> |
Oops, something went wrong.