Showing 91 of 92 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testGetTagsException()
{
$mock_response = new MockHttpResponse(404);
$stub_http_client = $this->createMock(\GuzzleHttp\Client::class);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testGetSfwException()
{
$mock_response = new MockHttpResponse(404);
$stub_http_client = $this->createMock(\GuzzleHttp\Client::class);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testFilelinkGetTagsException()
{
$mock_response = new MockHttpResponse(404);
$stub_http_client = $this->createMock(\GuzzleHttp\Client::class);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method testUploadIntelligentSuccess
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testUploadIntelligentSuccess()
{
$mock_response_202 = new MockHttpResponse(202, '{accepted: true}');
$mock_response = new MockHttpResponse(200,
json_encode([
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$response = $this->sendRequest('POST', $url, $data);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['form_params'] = ['url' => $resource];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$data' which will lead to PHP notices. Open
$data['body'] = fopen($resource, 'r');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Method processParts
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function processParts($parts)
{
$num_parts = count($parts);
$parts_etags = [];
$parts_completed = 0;
Method testconvertVideoSuccess
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testconvertVideoSuccess()
{
$mock_response = new MockHttpResponse(
200,
'{"uuid" : "some_uuid", "conversion_url": "http://someurl.com/handle"}'
Method testCollageSuccess
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCollageSuccess()
{
$filelink = new Filelink($this->test_file_handle,
$this->test_api_key,
$this->test_security);
Method testUploadSuccessWithOptions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testUploadSuccessWithOptions()
{
$test_headers = ['ETag' =>['some-etag']];
$mock_response = new MockHttpResponse(200,
json_encode([
Method testCreatePartsIntelligentSuccess
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCreatePartsIntelligentSuccess()
{
$mock_response = new MockHttpResponse(200,
json_encode([
'filename' => 'somefilename.jpg',
Method testProcessPartsIntelligentSuccess
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testProcessPartsIntelligentSuccess()
{
$test_headers = ['ETag' =>['some-etag']];
$mock_response = new MockHttpResponse(200,
json_encode([
Method testProcessPartsSuccess
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testProcessPartsSuccess()
{
$test_headers = ['ETag' =>['some-etag']];
$mock_response = new MockHttpResponse(200,
json_encode([
Method testCommitPartException
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCommitPartException()
{
$this->expectException(FilestackException::class);
$this->expectExceptionCode(400);
Method registerComplete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function registerComplete($api_key, $parts_etags, $upload_data,
$metadata)
{
$data = [];
$this->appendData($data, 'apikey', $api_key);
Method collage
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public function collage($sources, $width, $height, $store_options = [],
$color = 'white', $fit = 'auto', $margin = 10, $auto_rotate = false)
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testGetSfwSuccess()
{
$mock_response = new MockHttpResponse(
200,
'{"sfw": true}'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 100.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testFilelinkGetTagsSuccess()
{
$mock_response = new MockHttpResponse(
200,
'{"tags": "some-tags"}'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 100.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function testFilelinkGetSfwSuccess()
{
$mock_response = new MockHttpResponse(
200,
'{"sfw": true}'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 100.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76