Releases: traderinteractive/util-php
Version 1.6.0
Major Features
- Add Arrays::copyIfSet [PR #36]
Version 1.5.0: Manic Deer Hunter Basketball
Version 1.4.1
Version 1.4.0: In the Lost Kingdom of Tank Smash
New Features
String::ucwords [PR #27]
Added a new method to the string util that allows for uppercasing words in a string using a custom delimiter between words rather than just spaces like php's ucwords.
String::ellipsize [PR #27]
Added a new method to the string util that truncates a string to a given length with an ellipsis added at the end.
Arrays::extract [PR #29]
This method will take an array such as
$resultSet = [
['key' => '108273824', 'value' => 'http://www.example.com'],
['key' => '166799518', 'value' => 'N'],
['key' => '872314986', 'value' => '9999.99'],
['key' => '945587452', 'value' => ''],
['key' => '773529024', 'value' => 'Y'],
['key' => '872203238', 'value' => 'Y'],
['key' => '874939330', 'value' => '5551234567'],
]; and produce an array such as
array(8) {
[108273824] =>
string(33) "http://www.example.com/"
[166799518] =>
string(1) "N"
[872314986] =>
string(7) "9999.99"
[945587452] =>
string(0) ""
[773529024] =>
string(1) "Y"
[872203238] =>
string(1) "Y"
[874939330] =>
string(10) "5551234567"
}Developer Changes
- Update composer on travis builds. [PR #28]
Version 1.3.0
User changes
- Add Arrays::getIfSet
Developer changes
- Fix some incorrect docblock variable names in Util and File
- Clean up unit test doc blocks
- Force @Covers tags for tests
- Fix phpdoc for $key params in Arrays
- Add contributing guidelines
- Setup for scrutinizer ci
- Add poser.pugx.org composer badges
Version 1.2.0 - getQueryParams() $collapsedParams
Feature changes
- Add optional $collapsedParams to regular getQueryParams for the case when you only want to collapse a few
Developer changes
- Tiny performance improvement
- Add php 5.6 for travis
- Switch to PSR-4
Version 1.1.0 - getQueryParamsCollapsed
Major Features
New function for getting query parameters
Util\Http::getQueryParamsCollapsed() added to return back cleaner query parameter lists than what getQueryParams returns. Most of the time, query parameters are not urls and the existing method made accessing this common case a bit more difficult. Now you can get back single values much more easily, but still have secure, self-controlled ability to allow multiple items. Here's an example:
$params = \DominionEnterprises\Util\Http:getQueryParamsCollapsed(
'http://example.com/?foo=bar&zipCode=12345&zipCode=23456&image=test.png',
['zipCode', 'image', 'baz']
);
// $params['foo'] === 'bar'
// $params['zipCode'] === ['12345', '23456']
// $params['image'] === ['test.png']
// $params['baz'] is not setItems that are specified as being arrays will always be arrays if they are in the url (even if there is only one specified). All other items will be strings and will throw an exception if the url includes more than one of them.
Exception instances for ensure methods
Util::ensure and Util::ensureNot now accept an instance of Exception instead of having to specify exceptions the long way. However using the string is still preferred in performance critical situations.
For example:
\DominionEnterprises\Util::ensure(
true,
file_exists($someFile),
new \Exception("File {$someFile} did not exist!");
);Developer Changes
Some refactoring was done for Util::ensure, Util::ensureNot, and Util\Http::getQueryParams. Also test coverage lines were cleaned up using @coversDefaultClass to make the test stuff a bit simpler.
Version 1.0.0 - Initial release
This is the initial version for util-php, take a look in the source files (eg Arrays.php) for the docs !