Showing 58 of 60 total issues
File Client.php
has 435 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package gooddata-php-client
* @copyright Keboola
* @author Jakub Matejka <jakub@keboola.com>
Function diff
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function diff($pid, $model)
{
$uri = "/gdc/projects/$pid/model/diff?includeDeprecated=true&includeGrain=true";
$result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
- 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 normalizeModel
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
public function normalizeModel($model)
{
foreach ($model['projectModel']['datasets'] as &$d) {
if (isset($d['dataset']['anchor']['attribute']['labels'])) {
foreach ($d['dataset']['anchor']['attribute']['labels'] as &$l) {
- 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
Method unaccent
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function unaccent($string)
{
if (!preg_match('/[\x80-\xff]/', $string)) {
return $string;
}
Method getDataLoadManifest
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getDataLoadManifest(
$identifier,
array $columns,
$incrementalLoad = false
) {
Client
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class Client
{
/**
* Number of retries for one API call
*/
Function getDataLoadManifest
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function getDataLoadManifest(
$identifier,
array $columns,
$incrementalLoad = false
) {
- 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
File Projects.php
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package gooddata-php-client
* @copyright Keboola
* @author Jakub Matejka <jakub@keboola.com>
Function request
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function request($method, $uri, $params = [], $retries = 5)
{
$startTime = time();
$options = $this->guzzleOptions;
- 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 pollEtlTask
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function pollEtlTask($uri)
{
$try = 1;
do {
sleep(min(pow(2, $try), rand(15, 20)));
- 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
Method diff
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function diff($pid, $model)
{
$uri = "/gdc/projects/$pid/model/diff?includeDeprecated=true&includeGrain=true";
$result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
Function getToFile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getToFile($uri, $filename, $retries = 20)
{
$this->refreshToken();
$startTime = time();
- 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 update
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function update($pid, $model, $dryRun = false, $multivalueAttributes = [])
{
$model = $this->normalizeModel($model);
$update = $this->diff($pid, $model);
- 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 seemsUtf8
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function seemsUtf8($string)
{
for ($i = 0; $i < strlen($string); $i++) {
if (ord($string[$i]) < 0x80) {
continue; # 0bbbbbbb
- 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 saveLogs
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function saveLogs($folderName, $logFile)
{
$errors = [];
$uploadFile = "$folderName/upload_status.json";
- 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
File Datasets.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package gooddata-php-client
* @copyright Keboola
* @author Jakub Matejka <jakub@keboola.com>
Method getToFile
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getToFile($uri, $filename, $retries = 20)
{
$this->refreshToken();
$startTime = time();
Method __construct
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($username, $password, $url = '')
{
$this->username = $username;
$this->password = $password;
Method inviteUser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function inviteUser($pid, $email, $role = Projects::ROLE_ADMIN, $filters = [])
{
$projectRoleUri = $this->getRoleUri($pid, $role);
try {
Function parseMessage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function parseMessage($message)
{
if (isset($message['message'])) {
if (isset($message['parameters']) && count($message['parameters'])) {
$message = vsprintf($message['message'], $message['parameters']);
- 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"