Showing 14 of 370 total issues
Method testBuildingEntity
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBuildingEntity()
{
$social = new Social();
$social
->setField(Social::SOCIAL_FACEBOOK)
Address
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Address extends ArraySerializeable
{
const ADDRESS_BILLING = 'billing';
const ADDRESS_SHIPPING = 'shipping';
const ADDRESS_BOTH = 'both';
Method testBuildingEntity
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBuildingEntity()
{
$orderWithCoupon = new Order();
$orderWithCoupon
->setId('ORDER-531')
Method testBuildingEntity
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testBuildingEntity()
{
$entity = new Address();
$this->assertInstanceOf('Expressly\Entity\Address', $entity->setFirstName('Sam'));
Method testConstruction
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testConstruction()
{
$invoice = $this->getMockBuilder('Expressly\Entity\Invoice')->getMock();
$invoice->method('hasOrders')->willReturn(true);
$invoice->method('toArray')->willReturn(array(
Method testToArray
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testToArray($presenter)
{
$this->assertSame(
array(
'meta' => array(
Function addAddress
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function addAddress(Address $address, $primary = false, $type = null)
{
$addresses = $this->addresses;
$exists = function ($el) use ($addresses, $address) {
if ($el->toArray() == $address->toArray()) {
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(Merchant $merchant, Customer $customer, $email, $reference, $locale = 'en', EventDetails $eventDetails = null)
Function getURI
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getURI()
{
if (empty($this->parameters)) {
if (!empty($this->rules)) {
throw new InvalidURIException(reset($this->rules)->getMessage());
- 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 process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process($key)
{
foreach ($this->routes as $route) {
if ($route instanceof RouteInterface) {
if (($result = $route::match(preg_replace('/.*(expressly\/.*)/i', '/${1}', $key))) && $this->authenticate($route::isAuthenticated())) {
- 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
Avoid too many return
statements within this method. Open
return Logger::WARNING;
Function authenticate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function authenticate($restricted)
{
if ($restricted) {
if (!empty($_SERVER['HTTP_X_XLY_TOKEN']) &&
empty($_SERVER['PHP_AUTH_USER']) &&
- 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 importSearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function importSearch(&$config, $container)
{
foreach ($config as $key => $value) {
if ($key == 'imports') {
foreach ($value as $resource) {
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(Container $container, $hosts, $routes)
{
$this->routes = new ArrayCollection();
foreach ($routes as $key => $definition) {
- 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"