-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Optimize #108
Merged
Merged
[3.x] Optimize #108
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
707a978
take changes from crossjoin/browscap
mimmi20 0e50673
revert some changes
mimmi20 0496556
updates
mimmi20 07aff37
add php nightly to tests
mimmi20 291ba09
change detection
mimmi20 a7784d7
update from 3.x
mimmi20 a246477
remove include
mimmi20 dfeeaea
Merge branch 'master' of https://github.com/browscap/browscap-php int…
mimmi20 3e92776
update from master
mimmi20 7bae99d
update
mimmi20 737688e
revert change
mimmi20 c2fb053
revert change
mimmi20 dc24b39
update converter
mimmi20 3326b47
change detection
mimmi20 d950d19
update from master
mimmi20 c40e2e1
change detection
mimmi20 92e8be8
Merge branch 'optimize' of https://github.com/mimmi20/browscap-php in…
mimmi20 8451b22
update
mimmi20 a313591
changes
mimmi20 f8783c9
update creating cache
mimmi20 6b882aa
extract DataInterface
mimmi20 16f2aed
fix coding style
mimmi20 575bba6
skipping out a test on hhvm
mimmi20 7f789e8
skipping out a test on hhvm
mimmi20 5064c6f
update dependency injection
mimmi20 a1e895f
Merge branch 'master' of https://github.com/browscap/browscap-php int…
mimmi20 a24bfff
change parsing ini files, change tests
mimmi20 ba1897b
fix coding style
mimmi20 1968225
Skip code coverage generation on HHVM
mimmi20 8760732
change comment
mimmi20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
*~ | ||
.settings | ||
vendor/ | ||
.idea/ | ||
.buildpath | ||
.settings | ||
.project | ||
.idea/ | ||
vendor/ | ||
phpunit.xml | ||
composer.phar | ||
composer.lock | ||
resources/ | ||
PHP_BrowscapINI | ||
resources | ||
ergebnis.txt | ||
tests/data/* | ||
!tests/data/testdata.ini | ||
!tests/data/.gitkeep |
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
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
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
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,98 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 1998-2015 Browser Capabilities Project | ||
* | ||
* 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. | ||
* | ||
* @category Browscap-PHP | ||
* @package Parser | ||
* @copyright 1998-2015 Browser Capabilities Project | ||
* @license http://www.opensource.org/licenses/MIT MIT License | ||
* @link https://github.com/browscap/browscap-php/ | ||
* @since added with version 3.0 | ||
*/ | ||
|
||
namespace BrowscapPHP\Data; | ||
|
||
/** | ||
* Ini parser class (compatible with PHP 5.3+) | ||
* | ||
* @category Browscap-PHP | ||
* @package Parser | ||
* @author Christoph Ziegenberg <[email protected]> | ||
* @author Thomas Müller <[email protected]> | ||
* @copyright Copyright (c) 1998-2014 Browser Capabilities Project | ||
* @version 3.0 | ||
* @license http://www.opensource.org/licenses/MIT MIT License | ||
* @link https://github.com/browscap/browscap-php/ | ||
*/ | ||
class PropertyFormatter | ||
{ | ||
/** | ||
* @var PropertyHolder | ||
*/ | ||
private $propertyHolder = null; | ||
|
||
/** | ||
* class constructor | ||
* | ||
* @param PropertyHolder $propertyHolder | ||
*/ | ||
public function __construct(PropertyHolder $propertyHolder) | ||
{ | ||
$this->propertyHolder = $propertyHolder; | ||
} | ||
|
||
/** | ||
* formats the name of a property | ||
* | ||
* @param string $value | ||
* @param string $property | ||
* | ||
* @return string | ||
*/ | ||
public function formatPropertyValue($value, $property) | ||
{ | ||
$valueOutput = $value; | ||
|
||
switch ($this->propertyHolder->getPropertyType($property)) { | ||
case PropertyHolder::TYPE_BOOLEAN: | ||
if (true === $value || $value === 'true' || $value === '1') { | ||
$valueOutput = true; | ||
} elseif (false === $value || $value === 'false' || $value === '') { | ||
$valueOutput = false; | ||
} else { | ||
$valueOutput = ''; | ||
} | ||
break; | ||
case PropertyHolder::TYPE_IN_ARRAY: | ||
try { | ||
$valueOutput = $this->propertyHolder->checkValueInArray($property, $value); | ||
} catch (\InvalidArgumentException $ex) { | ||
$valueOutput = ''; | ||
} | ||
break; | ||
default: | ||
// nothing t do here | ||
break; | ||
} | ||
|
||
return $valueOutput; | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is CDF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asgrim
CDF
is a property which was part of the browscap.ini some time ago, I asume before you took over the project lead. I dont known what whis property is about.If you are installing an Xampp like I did an outdated browscap.ini was part of that installation.
Adding this property here should make sure, that the unittests for this library do not fail with an outdated ni file.