Skip to content
Open
80 changes: 39 additions & 41 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create();
$finder = PhpCsFixer\Finder::create();
$finder->in([
__DIR__ . '/src',
__DIR__ . '/tests/integration',
__DIR__ . '/tests/unit'
]);

$config = Symfony\CS\Config\Config::create();
$config->setUsingCache(true);
$config->setUsingLinter(false);
$config->finder($finder);
$config->level(Symfony\CS\FixerInterface::PSR2_LEVEL);
$config->fixers([
//symfony
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'include',
'join_function',
'multiline_array_trailing_comma',
'namespace_no_leading_whitespace',
'new_with_braces',
'no_blank_lines_after_class_opening',
'object_operator',
'operators_spaces',
'phpdoc_indent',
'phpdoc_params',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'single_array_no_trailing_comma',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'unused_use',
'whitespacy_lines',

//contrib
'align_double_arrow',
'align_equals',
'concat_with_spaces',
'multiline_spaces_before_semicolon',
'ordered_use',
'short_array_syntax',
]);
$config = PhpCsFixer\Config::create()
->setUsingCache(true)
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PhpCsFixer' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => false,
'return_assignment' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'dir_constant' => true,
'elseif' => false,
'ereg_to_preg' => true,
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'mb_str_functions' => true,
'phpdoc_order' => true,
'concat_space' => ['spacing' => 'one'],
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_classes' => true,
],
'phpdoc_to_comment' => false,
'method_argument_space' => ['on_multiline' => 'ignore'],
'php_unit_ordered_covers' => false,
'no_superfluous_elseif' => false,
]
);

return $config;
47 changes: 20 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "thadafinser/user-agent-parser",

"name": "ready2order/user-agent-parser",
"description": "UserAgent parsing done right http://useragent.mkf.solutions/",
"keywords": [
"UA",
Expand All @@ -9,13 +8,11 @@
"User agent",
"User agent parser",
"User agent detection",
"UserAgent",
"UserAgent",
"UserAgentParser",

"Sniffing",
"Parser",
"Parser",
"Detection",

"Browser",
"Engine",
"Rendering engine",
Expand All @@ -26,8 +23,7 @@
"mobile detection",
"mobile detector",
"mobile device detection",
"bot detection",

"bot detection",
"get_browser",
"browscap",
"donatj",
Expand All @@ -38,44 +34,38 @@
"whichbrowser",
"woothee",
"wurfl",

"DeviceAtlas",
"NeutrinoApiCom",
"UdgerCom",
"UserAgentApiCom",
"UserAgentStringCom",
"WhatIsMyBrowserCom"
],

"license": "MIT",
"authors": [
{
"name": "ThaDafinser",
"email": "martin.keckeis1@gmail.com"
}
],

"autoload": {
"psr-4": {
"UserAgentParser\\": "src"
"UserAgentParser\\": "src"
}
},

"autoload-dev": {
"psr-4": {
"UserAgentParserTest\\Unit\\": "tests/unit",
"UserAgentParserTest\\Integration\\": "tests/integration"
"UserAgentParserTest\\Unit\\": "tests/unit",
"UserAgentParserTest\\Integration\\": "tests/integration"
}
},

"require": {
"php": "~5.6|~7.0",
"guzzlehttp/guzzle": "^6.1",
"thadafinser/package-info": "^1.0"
"php": "^7.4|^8.0",
"guzzlehttp/guzzle": "^7.9",
"composer-runtime-api": "^2.0"
},

"conflict": {
"browscap/browscap-php": "<3,>=4",
"browscap/browscap-php": "^5.0",
"donatj/phpuseragentparser": "<0.5,>=1",
"jenssegers/agent": "<2.3,>=3",
"mobiledetect/mobiledetectlib": "<2.7.5,>=3",
Expand All @@ -87,7 +77,6 @@
"mimmi20/wurfl": "<1.6.4,>=2",
"zsxsoft/php-useragent": "<1.2,>=2"
},

"suggest": {
"browscap/browscap-php": "Needed to use Provider\\BrowscapPhp",
"donatj/phpuseragentparser": "Needed to use Provider\\DonatjUAParser",
Expand All @@ -102,12 +91,10 @@
"mimmi20/wurfl": "Needed to use Provider\\Wurfl",
"zsxsoft/php-useragent": "Needed to use Provider\\Zsxsoft"
},

"require-dev": {
"phpunit/phpunit": "^5.6.8",
"friendsofphp/php-cs-fixer": "^1.11",

"browscap/browscap-php": "^3.0",
"phpunit/phpunit": "^9.5",
"friendsofphp/php-cs-fixer": "^2.17.3",
"browscap/browscap-php": "^4.0",
"donatj/phpuseragentparser": "^0.5.0",
"endorphin-studio/browser-detector": "^3.0",
"handsetdetection/php-apikit": "^4.1.10",
Expand All @@ -120,5 +107,11 @@
"woothee/woothee": "^1.2",
"mimmi20/wurfl": "^1.7.1.1",
"zsxsoft/php-useragent": ">=1.2,<1.4"
},
"config": {
"preferred-install": "dist",
"platform": {
"php": "7.4.0"
}
}
}
11 changes: 1 addition & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
stopOnFailure="false"
processIsolation="false"
backupGlobals="false"
syntaxCheck="true"
>
>
<testsuites>
<testsuite name="UnitTests">
<directory suffix="Test.php">tests/unit</directory>
Expand All @@ -20,14 +19,6 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="coverage-html" target="./build" charset="UTF-8" highlight="false" lowUpperBound="35" highLowerBound="70"/>
</logging>

</phpunit>
3 changes: 2 additions & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace UserAgentParser\Exception;

/**
* Interface that in userland you can try/catch/finall all Exceptions from this package together
* Interface that in userland you can try/catch/finall all Exceptions from this package together.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
Expand Down
3 changes: 2 additions & 1 deletion src/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace UserAgentParser\Exception;

/**
* Thrown if an invalid argument is provided
* Thrown if an invalid argument is provided.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
Expand Down
7 changes: 5 additions & 2 deletions src/Exception/InvalidCredentialsException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace UserAgentParser\Exception;

use Exception;

/**
* This is thrown if a composer package is not loaded
* This is thrown if a composer package is not loaded.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
*/
class InvalidCredentialsException extends \Exception implements ExceptionInterface
class InvalidCredentialsException extends Exception implements ExceptionInterface
{
}
7 changes: 5 additions & 2 deletions src/Exception/LimitationExceededException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace UserAgentParser\Exception;

use Exception;

/**
* Limitation reached
* Limitation reached.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
*/
class LimitationExceededException extends \Exception implements ExceptionInterface
class LimitationExceededException extends Exception implements ExceptionInterface
{
}
5 changes: 4 additions & 1 deletion src/Exception/NoResultFoundException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace UserAgentParser\Exception;

use Exception;

/**
* This is thrown by the Provider if not result is found.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
*/
class NoResultFoundException extends \Exception implements ExceptionInterface
class NoResultFoundException extends Exception implements ExceptionInterface
{
}
7 changes: 5 additions & 2 deletions src/Exception/PackageNotLoadedException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace UserAgentParser\Exception;

use Exception;

/**
* This is thrown if a composer package is not loaded
* This is thrown if a composer package is not loaded.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
*/
class PackageNotLoadedException extends \Exception implements ExceptionInterface
class PackageNotLoadedException extends Exception implements ExceptionInterface
{
}
7 changes: 5 additions & 2 deletions src/Exception/RequestException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace UserAgentParser\Exception;

use Exception;

/**
* A HTTP request failed
* A HTTP request failed.
*
* @author Martin Keckeis <martin.keckeis1@gmail.com>
* @license MIT
*/
class RequestException extends \Exception implements ExceptionInterface
class RequestException extends Exception implements ExceptionInterface
{
}
Loading