@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if (is_object($value) || is_null($value)) { |
| 29 | 29 | $this->$name = $value; |
| 30 | 30 | } else { |
| 31 | - $this->$name = (string) $value; |
|
| 31 | + $this->$name = (string)$value; |
|
| 32 | 32 | } |
| 33 | 33 | return; |
| 34 | 34 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $processArray = function ($inputArray) use (&$processArray) { |
|
| 53 | + $processArray = function($inputArray) use (&$processArray) { |
|
| 54 | 54 | $processedArray = array(); |
| 55 | 55 | foreach ($inputArray as $key => $prop) { |
| 56 | 56 | if (is_string($prop)) { |
| 57 | - $propGetter = "get" . ucfirst($prop); |
|
| 57 | + $propGetter = "get".ucfirst($prop); |
|
| 58 | 58 | if (method_exists($this, $propGetter)) { |
| 59 | 59 | $processedArray[is_string($key) ? $key : $prop] = call_user_func(array($this, $propGetter)); |
| 60 | 60 | } else { |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * @return mixed |
| 36 | 36 | * @throws Exception |
| 37 | 37 | */ |
| 38 | - public static function getConfigField($key){ |
|
| 39 | - if(empty(static::$configArray)) { |
|
| 38 | + public static function getConfigField($key) { |
|
| 39 | + if (empty(static::$configArray)) { |
|
| 40 | 40 | Config::init(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | * @param $key |
| 54 | 54 | * @param $value |
| 55 | 55 | */ |
| 56 | - public static function setConfigField($key, $value){ |
|
| 57 | - if(empty(static::$configArray)) { |
|
| 56 | + public static function setConfigField($key, $value) { |
|
| 57 | + if (empty(static::$configArray)) { |
|
| 58 | 58 | Config::init(); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Created by PhpStorm. |
|
| 4 | - * User: uruba |
|
| 5 | - * Date: 2/15/2016 |
|
| 6 | - * Time: 2:54 PM |
|
| 7 | - */ |
|
| 3 | + * Created by PhpStorm. |
|
| 4 | + * User: uruba |
|
| 5 | + * Date: 2/15/2016 |
|
| 6 | + * Time: 2:54 PM |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | namespace FinanCalc\Utils { |
| 10 | 10 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $locale = Config::getConfigField("locale"); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $localePath = FinanCalc::getPath() . "/locale/$locale.php"; |
|
| 30 | + $localePath = FinanCalc::getPath()."/locale/$locale.php"; |
|
| 31 | 31 | |
| 32 | 32 | if (!file_exists($localePath)) { |
| 33 | 33 | return null; |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | $unformattedString = Strings::getString($identifier, $locale); |
| 56 | 56 | |
| 57 | 57 | return is_null($unformattedString) ? |
| 58 | - null : |
|
| 59 | - vsprintf($unformattedString, $formatArgs); |
|
| 58 | + null : vsprintf($unformattedString, $formatArgs); |
|
| 60 | 59 | } |
| 61 | 60 | } |
| 62 | 61 | } |
| 63 | 62 | \ No newline at end of file |
@@ -199,10 +199,10 @@ |
||
| 199 | 199 | private function newDateIntervalAbsolute($years, $months, $days) { |
| 200 | 200 | $this->setdateInterval( |
| 201 | 201 | new DateInterval( |
| 202 | - "P" . |
|
| 203 | - (string)$years . "Y" . |
|
| 204 | - (string)$months . "M" . |
|
| 205 | - (string)$days . "D" |
|
| 202 | + "P". |
|
| 203 | + (string)$years."Y". |
|
| 204 | + (string)$months."M". |
|
| 205 | + (string)$days."D" |
|
| 206 | 206 | ) |
| 207 | 207 | ); |
| 208 | 208 | } |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | * @return bool|null |
| 110 | 110 | */ |
| 111 | 111 | static function checkNumberRelativityToZero($checkedVariable, $expectedResult) { |
| 112 | - if(is_numeric((string)$checkedVariable)) { |
|
| 112 | + if (is_numeric((string)$checkedVariable)) { |
|
| 113 | 113 | return MathFuncs::comp($checkedVariable, "0.00") == $expectedResult; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * FinanCalc |
|
| 4 | - * |
|
| 5 | - * A lightweight, simple and easy PHP library for calculating annuities (e.g., mortgages) |
|
| 6 | - * and other financial instruments according to various input data |
|
| 7 | - * |
|
| 8 | - * |
|
| 9 | - * DISCLAIMER |
|
| 10 | - * You are free to use/modify/extend the library as you please - for it to serve your purpose. |
|
| 11 | - * As per the (un)license, the software is provided as is and the original author cannot be held liable |
|
| 12 | - * for any losses/damages directly or indirectly resulting from using thereof. |
|
| 13 | - * Attribution is welcome, but certainly not required. |
|
| 14 | - * |
|
| 15 | - * NOTE |
|
| 16 | - * The library is currently work-in-progress and it is certain that new features will be added in the process. |
|
| 17 | - * Consider this, therefore, as a preview product prone to abrupt and extensive changes that may affect functionality |
|
| 18 | - * of an external code adapted to a prior version(s) of the library. |
|
| 19 | - * Always explore the provisional compatibility of the library with your project in case you upgrade to a new version |
|
| 20 | - * of the library (by means of an extensive testing of the code in which you are exerting the library's features). |
|
| 21 | - * |
|
| 22 | - * PREREQUISITES |
|
| 23 | - * PHP 5.5+ |
|
| 24 | - * Module php-bcmath |
|
| 25 | - * |
|
| 26 | - * @author Václav Uruba |
|
| 27 | - * @version 0.3 |
|
| 28 | - * @license http://unlicense.org The Unlicense |
|
| 29 | - */ |
|
| 3 | + * FinanCalc |
|
| 4 | + * |
|
| 5 | + * A lightweight, simple and easy PHP library for calculating annuities (e.g., mortgages) |
|
| 6 | + * and other financial instruments according to various input data |
|
| 7 | + * |
|
| 8 | + * |
|
| 9 | + * DISCLAIMER |
|
| 10 | + * You are free to use/modify/extend the library as you please - for it to serve your purpose. |
|
| 11 | + * As per the (un)license, the software is provided as is and the original author cannot be held liable |
|
| 12 | + * for any losses/damages directly or indirectly resulting from using thereof. |
|
| 13 | + * Attribution is welcome, but certainly not required. |
|
| 14 | + * |
|
| 15 | + * NOTE |
|
| 16 | + * The library is currently work-in-progress and it is certain that new features will be added in the process. |
|
| 17 | + * Consider this, therefore, as a preview product prone to abrupt and extensive changes that may affect functionality |
|
| 18 | + * of an external code adapted to a prior version(s) of the library. |
|
| 19 | + * Always explore the provisional compatibility of the library with your project in case you upgrade to a new version |
|
| 20 | + * of the library (by means of an extensive testing of the code in which you are exerting the library's features). |
|
| 21 | + * |
|
| 22 | + * PREREQUISITES |
|
| 23 | + * PHP 5.5+ |
|
| 24 | + * Module php-bcmath |
|
| 25 | + * |
|
| 26 | + * @author Václav Uruba |
|
| 27 | + * @version 0.3 |
|
| 28 | + * @license http://unlicense.org The Unlicense |
|
| 29 | + */ |
|
| 30 | 30 | namespace FinanCalc { |
| 31 | 31 | use Exception; |
| 32 | 32 | use FinanCalc\Constants\ErrorMessages; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | |
| 116 | 116 | private function populateFactoryClassesArray() { |
| 117 | - $factoryFiles = glob(FinanCalc::getPath() . Config::getConfigField('factories_relative_path') . '/*.php'); |
|
| 117 | + $factoryFiles = glob(FinanCalc::getPath().Config::getConfigField('factories_relative_path').'/*.php'); |
|
| 118 | 118 | $factoriesNamespace = Config::getConfigField('factories_namespace'); |
| 119 | 119 | |
| 120 | 120 | foreach ($factoryFiles as $factoryFile) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | try { |
| 128 | 128 | /** @noinspection PhpIncludeInspection */ |
| 129 | 129 | require_once($factoryFile); |
| 130 | - $factoryClassReflector = new ReflectionClass($factoriesNamespace . '\\' . $factoryClassName); |
|
| 130 | + $factoryClassReflector = new ReflectionClass($factoriesNamespace.'\\'.$factoryClassName); |
|
| 131 | 131 | } catch (ReflectionException $e) { |
| 132 | 132 | error_log(ErrorMessages::getFactoryClassExpectedInNamespaceMessage($factoryClassName, $factoriesNamespace)); |
| 133 | 133 | continue; |
@@ -47,10 +47,10 @@ |
||
| 47 | 47 | * @param $bondPaymentFrequency |
| 48 | 48 | */ |
| 49 | 49 | function __construct($bondFaceValue, |
| 50 | - $bondAnnualCouponRate, |
|
| 51 | - $bondVIR, |
|
| 52 | - $bondYearsToMaturity, |
|
| 53 | - $bondPaymentFrequency = 1) { |
|
| 50 | + $bondAnnualCouponRate, |
|
| 51 | + $bondVIR, |
|
| 52 | + $bondYearsToMaturity, |
|
| 53 | + $bondPaymentFrequency = 1) { |
|
| 54 | 54 | $this->setBondFaceValue($bondFaceValue); |
| 55 | 55 | $this->setBondAnnualCouponRate($bondAnnualCouponRate); |
| 56 | 56 | $this->setBondVIR($bondVIR); |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | * @param null $stockAnnualDividendsGrowth |
| 45 | 45 | */ |
| 46 | 46 | function __construct(StockDDMTypes $dividendDiscountModelType, |
| 47 | - $stockVIR, |
|
| 48 | - $stockAnnualDividendValue, |
|
| 49 | - $stockAnnualDividendsGrowth = null) { |
|
| 47 | + $stockVIR, |
|
| 48 | + $stockAnnualDividendValue, |
|
| 49 | + $stockAnnualDividendsGrowth = null) { |
|
| 50 | 50 | $this->setDividendDiscountModelType($dividendDiscountModelType); |
| 51 | 51 | $this->setStockVIR($stockVIR); |
| 52 | 52 | $this->setStockAnnualDividendsValue($stockAnnualDividendValue); |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | /** |
| 71 | 71 | * @param $stockVIR |
| 72 | 72 | */ |
| 73 | - public function setStockVIR($stockVIR){ |
|
| 73 | + public function setStockVIR($stockVIR) { |
|
| 74 | 74 | $this->setProperty("stockVIR", $stockVIR, Lambdas::checkIfPositive()); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | * @param TimeSpan $time |
| 27 | 27 | */ |
| 28 | 28 | function __construct($amountDue, |
| 29 | - $annualDiscountRate, |
|
| 30 | - TimeSpan $time) { |
|
| 29 | + $annualDiscountRate, |
|
| 30 | + TimeSpan $time) { |
|
| 31 | 31 | $this->setAmountDue($amountDue); |
| 32 | 32 | $this->setAnnualDiscountRate($annualDiscountRate); |
| 33 | 33 | $this->setTime($time); |