Skip to content

Commit

Permalink
Merge pull request #9 from MarwanAlsoltany/dev
Browse files Browse the repository at this point in the history
Bug fixes and internal changes
  • Loading branch information
MarwanAlsoltany authored Nov 29, 2020
2 parents e8d3de3 + f5cf879 commit 59dd4dd
Show file tree
Hide file tree
Showing 78 changed files with 2,834 additions and 501 deletions.
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,36 @@ All notable changes to **AMQP Agent** will be documented in this file.
- Update `MagicMethodsExceptionsTrait`:
- Update exceptions messages to prevent notices when passing an array as an argument to magic methods.
- Fix coding style issues in different places.
- Rebuild documentation.
- Rebuild documentation.


## [1.2.2] - 2020-11-29
- Update `Config` class:
- Remove deprecated method `get()`.
- Remove `$configFlat` property and all of its references.
- Update `$configPath` property to be a realpath.
- Add `has()` method to quickly check if a config value exists.
- Add `get()` method to quickly get a config value (new functionality, should be backwards compatible).
- Add `set()` method to quickly set a config value.
- Update `Serializer` class:
- Add serializations types as class constants.
- Add methods to assert for PHP und JSON (un)serializations errors.
- Refactor `serialize()` and `unserialize()` methods to use assertions.
- Refactor `setType()` method to check if the type is supported.
- Add a new `$strict` property to determine serialization strictness and its corresponding `getStrict()` and `setStrict()` methods.
- Add `$strict` parameter to `serialize()` and `unserialize()` methods.
- Add `deserialize()` method as an alias for `unserialize()`.
- Refactor different methods to make use of available setters.
- Update DocBlocks und Exceptions Messages of different methods.
- Update `Utility` class:
- Add `objectToArray()` method.
- Add `arrayToObject()` method.
- Add `getArrayValueByKey()` method.
- Add `setArrayValueByKey()` method.
- Update `Logger` class:
- Fix an issue with `log()` method when checking for file size.
- Update tests
- Add new tests to the newly created methods.
- Update old tests to cover the new changes.
- Fix coding style issues in different places.
- Rebuild documentation.
4 changes: 2 additions & 2 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The file structure above is needed in order to run AMQP Agent composer scripts.
Some scripts expect a file to be created. They will throw an error if the file does not exist.
Files: `phpcs/index.xml`, `phpmd/index.xml`, and `phploc/index.html`.

Please not that these files shouldn't be committed. If a rebuild for the documenation is attempted they will get filled again, **delete their contants manually before commiting**.
Please not that these files shouldn't be committed. If a rebuild for the documentation is attempted they will get filled again, **delete their contents manually before committing**.


**Post build requirements**

PhpDox will include an absolute path to the files in source view when building the docs for example `C:/Users/SomeUser/SomeFolder/SomeOtherFolder/ProjectDirectory/src/Namespace/SomeClass.php`.

Using IDE find `C:/Users/SomeUser/SomeFolder/SomeOtherFolder/` in directories `docs` and `build` and replace it with an empty string, so that it looks like `ProjectDirectory/src/Namespace/SomeClass.php` without exposing private information about the developer's machine.
Using IDE find `C:/Users/SomeUser/SomeFolder/SomeOtherFolder/` in directories `docs` and `build` and replace it with an empty string, so that it looks like `ProjectDirectory/src/Namespace/SomeClass.php` without exposing private information about the developer's machine.
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/getConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line209">Source</a>
<a href="../../source/Client.php.html#line210">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/getConsumer.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line163">Source</a>
<a href="../../source/Client.php.html#line164">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/getLogger.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line196">Source</a>
<a href="../../source/Client.php.html#line197">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/getPublisher.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line142">Source</a>
<a href="../../source/Client.php.html#line143">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/getSerializer.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line183">Source</a>
<a href="../../source/Client.php.html#line184">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Client/gettable.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Client.php.html#line121">Source</a>
<a href="../../source/Client.php.html#line122">Source</a>
</li>
</ul>
</nav>
Expand Down
20 changes: 11 additions & 9 deletions docs/classes/MAKS_AmqpAgent_Config.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<a href="#methods">Methods</a>
</li>
<li>
<a href="../source/Config.php.html#line37">Source</a>
<a href="../source/Config.php.html#line36">Source</a>
</li>
</ul>
</nav>
Expand All @@ -83,14 +83,15 @@ <h4>A class that turns the configuration file into an object.</h4>
<h2 id="synopsis">Synopsis</h2>
<div class="synopsis">class Config
{<br/><ul class="none"><li>// constants</li><li>const DEFAULT_CONFIG_FILE_NAME = 'maks-amqp-agent-config';</li><li>const DEFAULT_CONFIG_FILE_PATH = __DIR__ . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . self::DEFAULT_CONFIG_FILE_NAME . '.php;</li></ul><ul class="none"><li>// members</li><li>private  <a href="#members">$config</a>;
</li><li>private  <a href="#members">$configFlat</a>;
</li><li>private  <a href="#members">$configPath</a>;
</li></ul><ul class="none"><li>// methods</li><li>public void <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/__construct.html">__construct</a>()
</li><li>public mixed <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/__get.html">__get</a>()
</li><li>public void <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/__set.html">__set</a>()
</li><li>public string <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/__toString.html">__toString</a>()
</li><li>private void <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/repair.html">repair</a>()
</li><li>public bool <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/has.html">has</a>()
</li><li>public mixed <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/get.html">get</a>()
</li><li>public Config <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/set.html">set</a>()
</li><li>public array <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/getDefaultConfig.html">getDefaultConfig</a>()
</li><li>public array <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/getConfig.html">getConfig</a>()
</li><li>public <span title="Config">Config</span> <a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/setConfig.html">setConfig</a>()
Expand All @@ -104,12 +105,12 @@ <h2 id="coverage">Coverage</h2>
<tr>
<td>Methods</td>
<td class="percent">100%</td>
<td class="nummeric">11 / 11</td>
<td class="nummeric">13 / 13</td>
</tr>
<tr>
<td>Lines</td>
<td class="percent">100%</td>
<td class="nummeric">42 / 42</td>
<td class="nummeric">39 / 39</td>
</tr>
</table>
<h2 id="violations">Violations</h2>
Expand All @@ -124,7 +125,7 @@ <h3>PHPMessDetector</h3>
</tr>
</thead>
<tr>
<td class="line">129</td>
<td class="line">122</td>
<td>
<a href="https://phpmd.org/rules/unusedcode.html#unusedlocalvariable" target="_blank" title="Unused Code Rules">UnusedLocalVariable</a>
</td>
Expand Down Expand Up @@ -158,9 +159,6 @@ <h4>private</h4>
<li id="config"><strong>$config</strong>
array<br/><span class="indent">The multidimensional configuration array.</span></li>
<li id="configFlat"><strong>$configFlat</strong>
array<br/><span class="indent">A flat version of the configuration array.</span></li>
<li id="configPath"><strong>$configPath</strong>
string<br/><span class="indent">Configuration file path.</span></li>
Expand All @@ -184,13 +182,17 @@ <h4>public</h4>
<li id="__toString"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/__toString.html">__toString()</a>
— Returns config file path if the object was casted to a string.</li>
<li id="get"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/get.html">get()</a>
— Gets a value of a key from the configuration array. Use with caution.</li>
— Gets a value of a key from the configuration array via dot-notation representation.</li>
<li id="getConfig"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/getConfig.html">getConfig()</a>
— Returns the current configuration array.</li>
<li id="getConfigPath"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/getConfigPath.html">getConfigPath()</a>
— Returns the path of the configuration file.</li>
<li id="getDefaultConfig"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/getDefaultConfig.html">getDefaultConfig()</a>
— Returns the default configuration array.</li>
<li id="has"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/has.html">has()</a>
— Checks wether a value exists in the configuration array via dot-notation representation.</li>
<li id="set"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/set.html">set()</a>
— Sets a value of a key from the configuration array via dot-notation representation.</li>
<li id="setConfig"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/setConfig.html">setConfig()</a>
— Sets a new configuration array to be used instead of the current and generates a new flat version of it.</li>
<li id="setConfigPath"><a title="MAKS\AmqpAgent\Config" href="../classes/MAKS_AmqpAgent_Config/setConfigPath.html">setConfigPath()</a>
Expand Down
12 changes: 7 additions & 5 deletions docs/classes/MAKS_AmqpAgent_Config/__construct.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line74">Source</a>
<a href="../../source/Config.php.html#line67">Source</a>
</li>
</ul>
</nav>
Expand All @@ -91,9 +91,9 @@ <h2 id="tests">Test Coverage</h2>
<div class="styled">
<h3>Information</h3>
<ul class="styled">
<li>Coverage: 9/9 Lines (100%)</li>
<li>Tests: 19</li>
<li>Passed: 19 (100%)</li>
<li>Coverage: 8/8 Lines (100%)</li>
<li>Tests: 21</li>
<li>Passed: 21 (100%)</li>
</ul>
<h3>Tests</h3>
<ul class="styled">
Expand All @@ -113,7 +113,9 @@ <h3>Tests</h3>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testSetConfigResetsTheConfigAndReturnsTheNewArray</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetConfigPath</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testSetConfigPathSetsANewPathAndRebuildsTheConfigObject</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetMethodReturnsAnExpectedValue</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testHasMethodReturnsAnExpectedValue</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetMethodReturnsAnExpectedValues</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testSetMethodSetsValuesAndGetMethodReturnsThem</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetDefaultConfigReturnsDefaultConfig</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testCastingConfigObjectToString</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/__get.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line95">Source</a>
<a href="../../source/Config.php.html#line88">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/__set.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line106">Source</a>
<a href="../../source/Config.php.html#line99">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/__toString.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line115">Source</a>
<a href="../../source/Config.php.html#line108">Source</a>
</li>
</ul>
</nav>
Expand Down
20 changes: 10 additions & 10 deletions docs/classes/MAKS_AmqpAgent_Config/get.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line146">Source</a>
<a href="../../source/Config.php.html#line150">Source</a>
</li>
</ul>
</nav>
<section>
<h1><small>MAKS\AmqpAgent\Config::</small>get</h1>
<h4>Gets a value of a key from the configuration array. Use with caution.</h4>
<p>Please note that this function returns the last occurrence of a key.
That's why it's not recommended to rely on the values provided by it.</p>
<h4>Gets a value of a key from the configuration array via dot-notation representation.</h4>
<p/>
<ul/>
<h2 id="signature">Signature</h2>
<div class="styled synopsis">
Expand All @@ -89,24 +88,25 @@ <h2 id="parameterlist">Parameters</h2>
<dt><code>$key</code>
string</dt>
<dd/>
<dd>The dotted key representation.</dd>
</dl>
<h2 id="return">Returns</h2>
<dl class="styled">
<dt>mixed</dt>
<dd/>
<dd>The requested value or null.</dd>
</dl>
<h2 id="tests">Test Coverage</h2>
<div class="styled">
<h3>Information</h3>
<ul class="styled">
<li>Coverage: 6/6 Lines (100%)</li>
<li>Tests: 1</li>
<li>Passed: 1 (100%)</li>
<li>Coverage: 2/2 Lines (100%)</li>
<li>Tests: 2</li>
<li>Passed: 2 (100%)</li>
</ul>
<h3>Tests</h3>
<ul class="styled">
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetMethodReturnsAnExpectedValue</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testGetMethodReturnsAnExpectedValues</li>
<li>[ <span class="testresult-PASSED">PASSED</span> ] — MAKS\AmqpAgent\Tests\ConfigTest::testSetMethodSetsValuesAndGetMethodReturnsThem</li>
</ul>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/getConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line172">Source</a>
<a href="../../source/Config.php.html#line184">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/getConfigPath.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line194">Source</a>
<a href="../../source/Config.php.html#line207">Source</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes/MAKS_AmqpAgent_Config/getDefaultConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<a href="#tests">Tests</a>
</li>
<li>
<a href="../../source/Config.php.html#line163">Source</a>
<a href="../../source/Config.php.html#line175">Source</a>
</li>
</ul>
</nav>
Expand Down
Loading

0 comments on commit 59dd4dd

Please sign in to comment.