lib/magento/Validator.php
public function validateCompatible(array $data)
    {
        if(!count($data)) {
            /**
             * Allow empty
             */
            return true;
        }
        $count = 0;
        foreach($data as $k=>$v) {
            foreach(array('name','channel','min','max') as $fld) {
                $$fld = trim($v[$fld]);
            }
            $count++;

            $res = $this->validateUrl($channel) && strlen($channel);
            if(!$res) {
                $this->addError("Invalid or empty channel in compat. #{$count}");
            }

            $res = $this->validatePackageName($name) && strlen($name);
            if(!$res) {
                $this->addError("Invalid or empty name in compat. #{$count}");
            }
            $res1 = $this->validateVersion($min);
            if(!$res1) {
                $this->addError("Invalid or empty minVersion in compat. #{$count}");
            }
            $res2 = $this->validateVersion($max);
            if(!$res2) {
                $this->addError("Invalid or empty maxVersion in compat. #{$count}");
            }
            if($res1 && $res2 && $this->versionLower($max, $min)) {
                $this->addError("Max version is lower than min in compat #{$count}");
            }

        }
        return ! $this->hasErrors();
    }
public function validateCompatible(array $data)
    {
        if(!count($data)) {
            /**
             * Allow empty
             */
            return true;
        }
        $count = 0;
        foreach($data as $k=>$v) {
            foreach(array('name','channel','min','max') as $fld) {
                $$fld = trim($v[$fld]);
            }
            $count++;

            $res = $this->validateUrl($channel) && strlen($channel);
            if(!$res) {
                $this->addError("Invalid or empty channel in compat. #{$count}");
            }

            $res = $this->validatePackageName($name) && strlen($name);
            if(!$res) {
                $this->addError("Invalid or empty name in compat. #{$count}");
            }
            $res1 = $this->validateVersion($min);
            if(!$res1) {
                $this->addError("Invalid or empty minVersion in compat. #{$count}");
            }
            $res2 = $this->validateVersion($max);
            if(!$res2) {
                $this->addError("Invalid or empty maxVersion in compat. #{$count}");
            }
            if($res1 && $res2 && $this->versionLower($max, $min)) {
                $this->addError("Max version is lower than min in compat #{$count}");
            }

        }
        return ! $this->hasErrors();
    }
public function validateCompatible ( array $ data ) { if ( ! count ( $ data ) ) { /**
             * Allow empty
             */ return true ; } $ count = 0 ; foreach ( $ data as $ k => $ v ) { foreach ( array ( 'name' , 'channel' , 'min' , 'max' ) as $ fld ) { $ $ fld = trim ( $ v [ $ fld ] ) ; } $ count ++ ; $ res = $ this -> validateUrl ( $ channel ) && strlen ( $ channel ) ; if ( ! $ res ) { $ this -> addError ( "Invalid or empty channel in compat. #{$count}" ) ; } $ res = $ this -> validatePackageName ( $ name ) && strlen ( $ name ) ; if ( ! $ res ) { $ this -> addError ( "Invalid or empty name in compat. #{$count}" ) ; } $ res1 = $ this -> validateVersion ( $ min ) ; if ( ! $ res1 ) { $ this -> addError ( "Invalid or empty minVersion in compat. #{$count}" ) ; } $ res2 = $ this -> validateVersion ( $ max ) ; if ( ! $ res2 ) { $ this -> addError ( "Invalid or empty maxVersion in compat. #{$count}" ) ; } if ( $ res1 && $ res2 && $ this -> versionLower ( $ max , $ min ) ) { $ this -> addError ( "Max version is lower than min in compat #{$count}" ) ; } } return ! $ this -> hasErrors ( ) ; }
Validate compatible data
@param array $data
@return bool
Validate compatible data