YetiForceCompany/YetiForceCRM

View on GitHub
app/YetiForce/Shop/AbstractBaseProduct.php

Summary

Maintainability
B
4 hrs
Test Coverage
F
10%

AbstractBaseProduct has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractBaseProduct
{
    private const DEFAULT_CURRENCY = 'EUR';

    /**
Severity: Minor
Found in app/YetiForce/Shop/AbstractBaseProduct.php - About 3 hrs to fix

    Method fromArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function fromArray(array $data)
        {
            $name = $data['name'] ?? '';
            $self = new static($name);
            $self->label = \App\Purifier::purifyByType($data['label'] ?? '', \App\Purifier::TEXT);
    Severity: Minor
    Found in app/YetiForce/Shop/AbstractBaseProduct.php - About 1 hr to fix

      Function fromArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fromArray(array $data)
          {
              $name = $data['name'] ?? '';
              $self = new static($name);
              $self->label = \App\Purifier::purifyByType($data['label'] ?? '', \App\Purifier::TEXT);
      Severity: Minor
      Found in app/YetiForce/Shop/AbstractBaseProduct.php - About 25 mins to fix

      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 '133', column '59').
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      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

      The method getAlertMessage has a boolean flag argument $require, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function getAlertMessage(bool $require = true): string

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Missing class import via use statement (line '133', column '99').
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      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

      Missing class import via use statement (line '133', column '33').
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      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\Purifier' in method 'fromArray'.
      Open

              $self->label = \App\Purifier::purifyByType($data['label'] ?? '', \App\Purifier::TEXT);

      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

      The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $this->expirationDate = null;
              }

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class '\App\YetiForce\Shop' in method 'getVariable'.
      Open

              ], \App\YetiForce\Shop::getVariablePayments());

      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\YetiForce\Register' in method '__construct'.
      Open

              $statusData = \App\YetiForce\Register::getProduct($productName);

      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\Purifier' in method 'fromArray'.
      Open

              $self->introduction = \App\Purifier::purifyByType($data['shortDescription'] ?? '', \App\Purifier::TEXT);

      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\Purifier' in method 'fromArray'.
      Open

              $self->description = \App\Purifier::decodeHtml(\App\Purifier::purifyByType($data['description'] ?? '', \App\Purifier::HTML));

      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\Fields\DateTime' in method '__construct'.
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      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\Purifier' in method 'fromArray'.
      Open

              $self->description = \App\Purifier::decodeHtml(\App\Purifier::purifyByType($data['description'] ?? '', \App\Purifier::HTML));

      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\Fields\Currency' in method 'fromArray'.
      Open

      }

      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

      syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
      Open

          protected string $id;
      Severity: Critical
      Found in app/YetiForce/Shop/AbstractBaseProduct.php by phan

      Avoid variables with short names like $a. Configured minimum length is 3.
      Open

                  usort($packages, fn ($a, $b) => $a->getPriceNet() <=> $b->getPriceNet());

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $id. Configured minimum length is 3.
      Open

          protected string $id;

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      Avoid variables with short names like $b. Configured minimum length is 3.
      Open

                  usort($packages, fn ($a, $b) => $a->getPriceNet() <=> $b->getPriceNet());

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      The 'getStatus()' method which returns a boolean should be named 'is...()' or 'has...()'
      Open

          public function getStatus(): bool
          {
              return $this->status;
          }

      BooleanGetMethodName

      Since: 0.2

      Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

      Example

      class Foo {
          /**
           * @return boolean
           */
          public function getFoo() {} // bad
          /**
           * @return bool
           */
          public function isFoo(); // ok
          /**
           * @return boolean
           */
          public function getFoo($bar); // ok, unless checkParameterizedMethods=true
      }

      Source https://phpmd.org/rules/naming.html#booleangetmethodname

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product ID.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Is the product featured.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var Package

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product label.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product name.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Price packages.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Is the product active.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $category;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $website;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Fit package.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $name;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product website.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected array $packages = [];

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $id;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product category.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected bool $active;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          private const DEFAULT_CURRENCY = 'EUR';

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected bool $featured;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Expiration date.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $description;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Image.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected bool $disabled = false;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /** @var bool Status */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @param string $productName

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $this->status = false;

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $this->status = strtotime($this->expirationDate) >= strtotime(date('Y-m-d'));

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->category = $data['category'] ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->description = \App\Purifier::decodeHtml(\App\Purifier::purifyByType($data['description'] ?? '', \App\Purifier::HTML));

      Spaces must be used to indent lines; tabs are not allowed
      Open

              if (isset($packages[$currencyCode])) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product ID.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getName(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $label;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var Package[]

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $currencyCode = \App\Fields\Currency::getDefault()['currency_code'];

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getLabel(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->label;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Constructor.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return static

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $name = $data['name'] ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self = new static($name);

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->introduction = \App\Purifier::purifyByType($data['shortDescription'] ?? '', \App\Purifier::TEXT);

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $self;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function isConfigured(): bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } elseif ($packages) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $self->packages = current($packages);

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product name.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return Package[]

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getPackages(): array

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->id = $data['id'] ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

                      $packages[$package->getCurrencyCode()][] = $package;

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } elseif (isset($packages[self::DEFAULT_CURRENCY])) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          private bool $status = false;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return true;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public static function fromArray(array $data)

      Spaces must be used to indent lines; tabs are not allowed
      Open

              foreach ($data['packages'] as $packageData) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $self->packages = $packages[self::DEFAULT_CURRENCY];

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getId(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $packages = [];

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get category.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected $package;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              if ($statusData) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $expiresAt = $statusData['expiresAt'];

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Check if the product is configured correctly.

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $package = new Package($packageData);

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Price packages.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @param array $data

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string|null

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected ?string $expirationDate;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @var string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  if ($package->isAvailable()) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->category;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Introduction / short description.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /** @var bool Disabled product */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $statusData = \App\YetiForce\Register::getProduct($productName);

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getStatus(): bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Construct.

      Line exceeds 120 characters; contains 133 characters
      Open

              $self->description = \App\Purifier::decodeHtml(\App\Purifier::purifyByType($data['description'] ?? '', \App\Purifier::HTML));

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->image = $data['imageUrl'] ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

              }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected ?string $image;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Line exceeds 120 characters; contains 176 characters
      Open

                  $this->expirationDate = (new \DateTime($expiresAt, new \DateTimeZone('GMT')))->setTimezone(new \DateTimeZone(\App\Fields\DateTime::getTimeZone()))->format('Y-m-d');

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } else {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->status;

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->featured = $data['featured'] ?? false;

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $self->packages = $packages[$currencyCode];

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product price.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          protected string $introduction;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->id;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->packages;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->package->getPaymentFrequency();

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'currency_code' => $this->getCurrencyCode(),

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'os0' => $this->package->getName(),

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } elseif ($this->isExpired()) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Description.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function __construct(string $productName)

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $this->name = $productName;

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $this->expirationDate = null;

      Spaces must be used to indent lines; tabs are not allowed
      Open

              }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get subscription status.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->label = \App\Purifier::purifyByType($data['label'] ?? '', \App\Purifier::TEXT);

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $self->website = $data['website'] ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product label.

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->name;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getCategory(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product image.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getPaymentFrequencyShort(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $message = '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return \Vtiger_Link_Model[]

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getAdditionalButtons(): array

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->package;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  't3' => 'M',

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'p3' => 1,

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getSwitchButton(): ?\Vtiger_Link_Model

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getImage(): ?string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

              if ($this->disabled) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } elseif ($status && !$this->isConfigured()) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Analyze the configuration.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return \Vtiger_Link_Model|null

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->package->getCurrencyCode();

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return Package|null

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->package->getPaymentFrequencyShort();

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return array_merge([

      Spaces must be used to indent lines; tabs are not allowed
      Open

              $status = $this->getStatus();

      Spaces must be used to indent lines; tabs are not allowed
      Open

              }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getCurrencyCode(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get fit package.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getIntroduction(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

              ], \App\YetiForce\Shop::getVariablePayments());

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getFitPackage(): ?Package

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->image ?? '';

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * The period for which the service is purchased.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return array

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getVariable(): array

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'on0' => 'Package',

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $message = 'LBL_FUNCTIONALITY_NOT_AVAILABLE';

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $message = 'LBL_SUBSCRIPTION_HAS_EXPIRED';

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return [];

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->package->getPrice();

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->description;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getPaymentFrequency(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'src' => 1,

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $message = 'LBL_FUNCTIONALITY_HAS_NOT_YET_BEEN_ACTIVATED';

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Product modal additional buttons.

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return null;

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->expirationDate ?? null;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function isActive(): bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  usort($packages, fn ($a, $b) => $a->getPriceNet() <=> $b->getPriceNet());

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->introduction;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return ?string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getAlertMessage(bool $require = true): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string|null

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return isset($this->expirationDate) && !$this->status;

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getDescription(): string

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return string

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'cmd' => '_xclick-subscriptions',

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'no_shipping' => 1,

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'no_note' => 1,

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return array

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function analyzeConfiguration(): array

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return [];

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Check if product is available.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product description.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get variable product.

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'sra' => 1,

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @param bool $require

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Check if the service is active.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $message = 'LBL_PAID_FUNCTIONALITY';

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return array

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $packages = $this->getPackages();

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  $this->package = current($packages);

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get product description.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get short period name for which the service is purchased.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'a3' => $this->package->getPriceGross()

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Show alert in marketplace.

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $message;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return int

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get currency code.

      Spaces must be used to indent lines; tabs are not allowed
      Open

              if (!$this->package) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

              }

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function isExpired(): bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

              } elseif ($require && !$status) {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getPrice(): int

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

                  'item_name' => $this->name,

      Spaces must be used to indent lines; tabs are not allowed
      Open

          }

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Switch button to activate/deactivate service.

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return !empty($this->getFitPackage());

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * Get expiration date.

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

          {

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function isAvailable(): bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

          public function getExpirationDate(): ?string

      Spaces must be used to indent lines; tabs are not allowed
      Open

           * @return bool

      Spaces must be used to indent lines; tabs are not allowed
      Open

           */

      Spaces must be used to indent lines; tabs are not allowed
      Open

          /**

      Spaces must be used to indent lines; tabs are not allowed
      Open

              return $this->active;

      Spaces must be used to indent lines; tabs are not allowed
      Open

           *

      Space before opening parenthesis of function call prohibited
      Open

                  usort($packages, fn ($a, $b) => $a->getPriceNet() <=> $b->getPriceNet());

      There are no issues that match your filters.

      Category
      Status