dynamic/foxystripe

View on GitHub

Showing 96 of 127 total issues

Method fc_hash_querystring has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function fc_hash_querystring($qs, $output = true)
    {
        self::$log[] = '<strong>Signing link</strong> with data: '
            .htmlspecialchars(substr($qs, 0, 150)).'...';
        $fail = self::$cart_url.'?'.$qs;
Severity: Major
Found in src/Model/foxycart.cart_validation.php - About 2 hrs to fix

Function Brush has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Brush()
    {
        function getKeywordsCSS(str)
        {
            return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
Severity: Major
Found in thirdparty/flexslider/demo/js/shBrushCss.js - About 2 hrs to fix

Method getEditForm has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getEditForm($id = null, $fields = null)
    {
        $config = FoxyStripeSetting::current_foxystripe_setting();
        $fields = $config->getCMSFields();

Severity: Major
Found in src/Admin/FoxyStripeAdmin.php - About 2 hrs to fix

Function setup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    slider.setup = function(type) {
      // SLIDE:
      if (!fade) {
        var sliderOffset, arr;

Severity: Major
Found in thirdparty/flexslider/jquery.flexslider.js - About 2 hrs to fix

Method updateConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function updateConfig()
    {
        $data = static::config()->get('data');
        $transactionDate = $data['TransactionDate'];
        static::config()->merge('data', [
Severity: Minor
Found in src/Controller/DataTestController.php - About 1 hr to fix

Function queryNewValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        queryNewValue = function (code, newValue, link, id, clicked) {
            var quantData = {
                'code': code,
                'value': newValue,
                'id': id,
Severity: Minor
Found in client/src/javascript/quantity.js - About 1 hr to fix

Function setup has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setup: function() {
          slider.asNav = true;
          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
          slider.currentItem = slider.currentSlide;
          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
Severity: Minor
Found in thirdparty/flexslider/jquery.flexslider.js - About 1 hr to fix

Function queryNewValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        queryNewValue = function (code, newValue, link, id, clicked) {
            var quantData = {
                'code': code,
                'value': newValue,
                'id': id,
Severity: Minor
Found in javascript/quantity.js - About 1 hr to fix

Method parseOrderDetails has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseOrderDetails($response)
    {

        // remove previous OrderDetails and OrderOptions so we don't end up with duplicates
        foreach ($this->Details() as $detail) {
Severity: Minor
Found in src/Model/Order.php - About 1 hr to fix

Function fc_hash_querystring has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fc_hash_querystring($qs, $output = true)
    {
        self::$log[] = '<strong>Signing link</strong> with data: '
            .htmlspecialchars(substr($qs, 0, 150)).'...';
        $fail = self::$cart_url.'?'.$qs;
Severity: Minor
Found in src/Model/foxycart.cart_validation.php - About 1 hr 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

Function setupPaging has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setupPaging: function() {
          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
              j = 1,
              item,
              slide;
Severity: Minor
Found in thirdparty/flexslider/jquery.flexslider.js - About 1 hr to fix

Method getProductOptionSet has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getProductOptionSet()
    {
        $options = $this->product->ProductOptions();
        $groupedOptions = new GroupedList($options);
        $groupedBy = $groupedOptions->groupBy('ProductOptionGroupID');
Severity: Minor
Found in src/Form/FoxyStripePurchaseForm.php - About 1 hr to fix

Function Brush has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function Brush()
    {
        function process(match, regexInfo)
        {
            var constructor = SyntaxHighlighter.Match,
Severity: Minor
Found in thirdparty/flexslider/demo/js/shBrushXml.js - About 1 hr to fix

Method index has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function index()
    {
        $rules = Director::config()->get('rules');
        $rule = array_search(FoxyStripeController::class, $rules);
        $myURL = Director::absoluteBaseURL() . explode('//', $rule)[0];
Severity: Minor
Found in src/Controller/DataTestController.php - About 1 hr to fix

Method encrypt has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static function encrypt ($pwd, $data, $ispwdHex = 0)
    {
        if ($ispwdHex)
            $pwd = @pack('H*', $pwd); // valid input, please!
 
Severity: Minor
Found in thirdparty/rc4crypt.php - About 1 hr to fix

Function setProps has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    slider.setProps = function(pos, special, dur) {
      var target = (function() {
        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
            posCalc = (function() {
              if (carousel) {
Severity: Minor
Found in thirdparty/flexslider/jquery.flexslider.js - About 1 hr to fix

Method setCurrentStore has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function setCurrentStore()
    {
        $client = $this->getClient();
        $config = FoxyStripeSetting::current_foxystripe_setting();

Severity: Minor
Found in src/Model/FoxyStripeClient.php - About 1 hr to fix

Function onBeforeWrite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        if (!$this->CategoryID) {
            $default = ProductCategory::get()->filter(['Code' => 'DEFAULT'])->first();
Severity: Minor
Found in src/Page/ProductPage.php - About 1 hr 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

Function loadDescendantProductGroupIDListInto has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadDescendantProductGroupIDListInto(&$idList)
    {
        if ($children = $this->AllChildren()) {
            foreach ($children as $child) {
                if (in_array($child->ID, $idList)) {
Severity: Minor
Found in src/Page/ProductHolder.php - About 1 hr 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

Function setup has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        setup: function() {
          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');

          // CONTROLSCONTAINER:
          if (slider.controlsContainer) {
Severity: Minor
Found in thirdparty/flexslider/jquery.flexslider.js - About 1 hr to fix
Severity
Category
Status
Source
Language