Sulu\Bundle\MediaBundle\Media\FormatLoader\XmlFormatLoader11::getScaleFromFormatNode PHP Method

getScaleFromFormatNode() protected method

protected getScaleFromFormatNode ( DOMNode $formatNode )
$formatNode DOMNode
    protected function getScaleFromFormatNode(\DOMNode $formatNode)
    {
        $scale = null;
        $formatScaleNode = $this->xpath->query('x:scale', $formatNode)->item(0);
        if ($formatScaleNode !== null) {
            $xNode = $this->xpath->query('@x', $formatScaleNode)->item(0);
            $yNode = $this->xpath->query('@y', $formatScaleNode)->item(0);
            $modeNode = $this->xpath->query('@mode', $formatScaleNode)->item(0);
            $retinaNode = $this->xpath->query('@retina', $formatScaleNode)->item(0);
            $forceRatioNode = $this->xpath->query('@forceRatio', $formatScaleNode)->item(0);
            if ($xNode === null && $yNode === null) {
                throw new MissingScaleDimensionException();
            }
            $forceRatio = static::SCALE_FORCE_RATIO_DEFAULT;
            $retina = static::SCALE_RETINA_DEFAULT;
            if ($forceRatioNode !== null && $forceRatioNode->nodeValue === 'false') {
                $forceRatio = false;
            }
            if ($retinaNode !== null && $retinaNode->nodeValue === 'true') {
                $retina = false;
            }
            $scale = ['x' => $xNode !== null ? intval($xNode->nodeValue) : null, 'y' => $yNode !== null ? intval($yNode->nodeValue) : null, 'mode' => $modeNode !== null ? $modeNode->nodeValue : static::SCALE_MODE_DEFAULT, 'retina' => $retina, 'forceRatio' => $forceRatio];
        }
        return $scale;
    }