protected function validateBlockLayout(array $data)
    {
        foreach (array_keys(static::getDevices()) as $device) {
            // If layout set for this device
            if (!isset($data[$device])) {
                continue;
            }

            $size = isset($data[$device][static::SIZE]) ? $data[$device][static::SIZE] : 12;
            $offset = isset($data[$device][static::OFFSET]) ? $data[$device][static::OFFSET] : 0;

            // Validate size
            if (1 > $size || $size > 12) {
                throw new InvalidArgumentException('Invalid layout size');
            }

            // Validate offset
            if (0 > $offset || $offset > 11) {
                throw new InvalidArgumentException('Invalid layout offset');
            }

            // Validate sum
            if (12 < ($size + $offset)) {
                throw new InvalidArgumentException('Invalid block layout size/offset');
            }
        }
    }
protected function validateBlockLayout(array $data)
    {
        foreach (array_keys(static::getDevices()) as $device) {
            // If layout set for this device
            if (!isset($data[$device])) {
                continue;
            }

            $size = isset($data[$device][static::SIZE]) ? $data[$device][static::SIZE] : 12;
            $offset = isset($data[$device][static::OFFSET]) ? $data[$device][static::OFFSET] : 0;

            // Validate size
            if (1 > $size || $size > 12) {
                throw new InvalidArgumentException('Invalid layout size');
            }

            // Validate offset
            if (0 > $offset || $offset > 11) {
                throw new InvalidArgumentException('Invalid layout offset');
            }

            // Validate sum
            if (12 < ($size + $offset)) {
                throw new InvalidArgumentException('Invalid block layout size/offset');
            }
        }
    }
protected function validateBlockLayout ( array $ data ) { foreach ( array_keys ( static :: getDevices ( ) ) as $ device ) { // If layout set for this device if ( ! isset ( $ data [ $ device ] ) ) { continue ; } $ size = isset ( $ data [ $ device ] [ static :: SIZE ] ) ? $ data [ $ device ] [ static :: SIZE ] : 12 ; $ offset = isset ( $ data [ $ device ] [ static :: OFFSET ] ) ? $ data [ $ device ] [ static :: OFFSET ] : 0 ; // Validate size if ( 1 > $ size || $ size > 12 ) { throw new InvalidArgumentException ( 'Invalid layout size' ) ; } // Validate offset if ( 0 > $ offset || $ offset > 11 ) { throw new InvalidArgumentException ( 'Invalid layout offset' ) ; } // Validate sum if ( 12 < ( $ size + $ offset ) ) { throw new InvalidArgumentException ( 'Invalid block layout size/offset' ) ; } } }
Validates the block layout.

@param array $data

@throws InvalidArgumentException
Validates the block layout .