Method getOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getOptions(): array
{
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
$options = [
'headers' => [
Function getOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function getOptions(): array
{
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
$options = [
'headers' => [
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getSoapOptions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getSoapOptions(): array
{
$options = [
'trace' => 1,
'exceptions' => 1,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '35', column '14'). Open
return new \GuzzleHttp\Client(\App\Utils::merge(self::getOptions(), $config));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Utils' in method 'getClient'. Open
return new \GuzzleHttp\Client(\App\Utils::merge(self::getOptions(), $config));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Composer\CaBundle\CaBundle' in method 'getOptions'. Open
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Version' in method 'getOptions'. Open
'User-Agent' => 'YetiForceCRM/' . Version::get(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Version' in method 'getSoapOptions'. Open
'user_agent' => 'YetiForceCRM/' . Version::get(),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to method __construct
from undeclared class \GuzzleHttp\Client
Open
return new \GuzzleHttp\Client(\App\Utils::merge(self::getOptions(), $config));
- Exclude checks
Return type of getClient()
is undeclared type \GuzzleHttp\Client
Open
public static function getClient(array $config = []): \GuzzleHttp\Client
- Exclude checks
Call to method getSystemCaRootBundlePath
from undeclared class \Composer\CaBundle\CaBundle
Open
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyLogin)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= '@';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $options;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int The number of seconds to wait while trying to connect to a server. Use 0 to wait indefinitely (the default behavior). */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return new \GuzzleHttp\Client(\App\Utils::merge(self::getOptions(), $config));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $options;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= ':' . \Config\Security::$proxyPassword;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'verify' => \is_file($caPathOrFile) ? $caPathOrFile : false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \GuzzleHttp\Client
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyConnection)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get default configuration for SoapClient.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options['proxy'] = $proxy;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_agent' => 'YetiForceCRM/' . Version::get(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'trace' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPort)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Total timeout of the request in seconds. Use 0 to wait indefinitely (the default behavior). */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getOptions(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'connect_timeout' => self::$connectTimeout,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getSoapOptions(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $config
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getClient(array $config = []): \GuzzleHttp\Client
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyProtocol)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'headers' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'exceptions' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyConnection)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options['proxy_host'] = \Config\Security::$proxyHost;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options['proxy_port'] = \Config\Security::$proxyPort;
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
/** @var int The number of seconds to wait while trying to connect to a server. Use 0 to wait indefinitely (the default behavior). */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get default configuration for GuzzleHttp Client.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $connectTimeout = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= ':' . \Config\Security::$proxyPort;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options['proxy_login'] = \Config\Security::$proxyLogin;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get GuzzleHttp client instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPassword)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $timeout = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'User-Agent' => 'YetiForceCRM/' . Version::get(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= \Config\Security::$proxyLogin;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPassword)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= \Config\Security::$proxyProtocol . '://';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy .= \Config\Security::$proxyHost;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'connection_timeout' => self::$timeout,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPort)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'timeout' => self::$timeout,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyLogin)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options['proxy_password'] = \Config\Security::$proxyPassword;
- Exclude checks