propertySanitizer = $propertySanitizer; } public function handlesRule( Rule $rule ) { return $rule instanceof AtRule && in_array( strtolower( $rule->getName() ), self::$marginRuleNames, true ); } protected function doSanitize( CSSObject $object ) { if ( !$object instanceof Rule || !$this->handlesRule( $object ) ) { $this->sanitizationError( 'expected-page-margin-at-rule', $object ); return null; } if ( $object->getBlock() === null ) { $this->sanitizationError( 'at-rule-block-required', $object, [ $object->getName() ] ); return null; } // No non-whitespace prelude allowed if ( Util::findFirstNonWhitespace( $object->getPrelude() ) ) { $this->sanitizationError( 'invalid-page-margin-at-rule', $object, [ $object->getName() ] ); return null; } $ret = clone( $object ); $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeDeclarationBlock( $ret->getBlock(), $this->propertySanitizer ); return $ret; } }