Commit aa241d0a authored by Mathias Verraes's avatar Mathias Verraes
Browse files

shorter namespace

parent ef68dd58
.project
.buildpath
.settings
build/
\ No newline at end of file
build/
phpunit.xml
\ No newline at end of file
Verraes\Money
Money
=============
Also see http://blog.verraes.net/2011/04/fowler-money-pattern-in-php/
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
class Currency
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
/** @see http://en.wikipedia.org/wiki/Currency_pair */
class CurrencyPair
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
/**
* @see http://www.phpkode.com/tips/item/exception-best-practices-in-php-5-3/
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
class InvalidArgumentException extends \InvalidArgumentException implements Exception
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
class Money
{
......@@ -22,14 +22,14 @@ class Money
*/
private $units;
/** @var Verraes\Money\Currency */
/** @var Money\Currency */
private $currency;
/**
* Create a Money instance
* @param integer $units Amount, expressed in the smallest units of $currency (eg cents)
* @param Verraes\Money\Currency $currency
* @throws Verraes\Money\InvalidArgumentException
* @param Money\Currency $currency
* @throws Money\InvalidArgumentException
*/
public function __construct($units, Currency $currency)
{
......@@ -83,7 +83,7 @@ class Money
}
/**
* @throws Verraes\Money\InvalidArgumentException
* @throws Money\InvalidArgumentException
*/
private function assertSameCurrency(Money $other)
{
......@@ -130,7 +130,7 @@ class Money
}
/**
* @return Verraes\Money\Currency
* @return Money\Currency
*/
public function getCurrency()
{
......@@ -150,7 +150,7 @@ class Money
}
/**
* @throws Verraes\Money\InvalidArgumentException
* @throws Money\InvalidArgumentException
*/
private function assertOperand($operand)
{
......@@ -160,7 +160,7 @@ class Money
}
/**
* @throws Verraes\Money\InvalidArgumentException
* @throws Money\InvalidArgumentException
*/
private function assertRoundingMode($rounding_mode)
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -8,7 +8,7 @@
* file that was distributed with this source code.
*/
namespace Verraes\Money;
namespace Money;
class UnknownCurrencyException extends \Exception implements Exception
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -10,9 +10,9 @@
require_once 'bootstrap.php';
use Verraes\Money\Money;
use Verraes\Money\Currency;
use Verraes\Money\CurrencyPair;
use Money\Money;
use Money\Currency;
use Money\CurrencyPair;
class CurrencyPairTest extends PHPUnit_Framework_TestCase
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -10,7 +10,7 @@
require_once 'bootstrap.php';
use Verraes\Money\Currency;
use Money\Currency;
class CurrencyTest extends PHPUnit_Framework_TestCase
{
......@@ -41,7 +41,7 @@ class CurrencyTest extends PHPUnit_Framework_TestCase
/**
* @test
* @expectedException Verraes\Money\UnknownCurrencyException
* @expectedException Money\UnknownCurrencyException
*/
public function testCantInstantiateUnknownCurrency()
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -10,8 +10,8 @@
require_once 'bootstrap.php';
use Verraes\Money\Money;
use Verraes\Money\Currency;
use Money\Money;
use Money\Currency;
class MoneyTest extends PHPUnit_Framework_TestCase
{
......@@ -50,7 +50,7 @@ class MoneyTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Verraes\Money\InvalidArgumentException
* @expectedException Money\InvalidArgumentException
*/
public function testDecimalsThrowException()
{
......@@ -58,7 +58,7 @@ class MoneyTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Verraes\Money\InvalidArgumentException
* @expectedException Money\InvalidArgumentException
*/
public function testStringThrowsException()
{
......@@ -92,7 +92,7 @@ class MoneyTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Verraes\Money\InvalidArgumentException
* @expectedException Money\InvalidArgumentException
*/
public function testDifferentCurrenciesCannotBeAdded()
{
......@@ -116,7 +116,7 @@ class MoneyTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Verraes\Money\InvalidArgumentException
* @expectedException Money\InvalidArgumentException
*/
public function testDifferentCurrenciesCannotBeSubtracted()
{
......@@ -176,7 +176,7 @@ class MoneyTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Verraes\Money\InvalidArgumentException
* @expectedException Money\InvalidArgumentException
*/
public function testDifferentCurrenciesCannotBeCompared()
{
......
<?php
/**
* This file is part of the Verraes\Money library
* This file is part of the Money library
*
* Copyright (c) 2011 Mathias Verraes
*
......@@ -9,9 +9,9 @@
*/
require_once 'PHPUnit/Framework/TestCase.php';
require_once __DIR__.'/../lib/Verraes/Money/Currency.php';
require_once __DIR__.'/../lib/Verraes/Money/CurrencyPair.php';
require_once __DIR__.'/../lib/Verraes/Money/Exception.php';
require_once __DIR__.'/../lib/Verraes/Money/InvalidArgumentException.php';
require_once __DIR__.'/../lib/Verraes/Money/UnknownCurrencyException.php';
require_once __DIR__.'/../lib/Verraes/Money/Money.php';
require_once __DIR__.'/../lib/Money/Currency.php';
require_once __DIR__.'/../lib/Money/CurrencyPair.php';
require_once __DIR__.'/../lib/Money/Exception.php';
require_once __DIR__.'/../lib/Money/InvalidArgumentException.php';
require_once __DIR__.'/../lib/Money/UnknownCurrencyException.php';
require_once __DIR__.'/../lib/Money/Money.php';
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment