@param Document $document

@return \PHPPdf\Core\Engine\Image
514130
protected function createImageSource(Document $document)
    {
        $src = $this->getAttribute('src');

        return is_string($src) ? $this->createSource($document) : $src;
    }
1028245
private function getIdForIdentityMap($document)
    {
        $class = $this->dm->getClassMetadata(get_class($document));

        if ($class->getIndex() === null) {
            $id = spl_object_hash($document);
        } else {
            $id = $class->createIdentifier($document)->getSerialized();
        }

        return $id;
    }
767981
protected function getHideMobile(Document $document) 
	{
		foreach($document->getMetadata() as $meta) {
			if('hidemobile' == $meta->getKey()) {
				$v = $meta->getValue();
				return $v;
				break;
			}
		}
		
		return false;
	}
774541
public function getVersion(\DOMDocument $document)
    {
        if (empty($document->documentElement)) {
            return '';
        }

        $xpath = $this->getXpath($document);
        $this->setNs($document);
        $xpath->registerNamespace('cbc', self::CBC_NS);

        return $this->getSingleValue($xpath, 'cbc:UBLVersionID');
    }
1073646
protected function fill($document, \stdClass $object)
    {
        $metadata = $this->getMetadataFactory()->getMetadataFor(get_class($document));
        $propertyAnnotations = $this->getMetadataFactory()->getObjectPropertyAnnotations($document);

        foreach ($propertyAnnotations as $property => $annotation) {
            $documentProperty = $property;

            if ($annotation->name) {
                $property = $annotation->name;
            }

            if (property_exists($object, $property)) {
                $value = $this->hydrateValue($object->$property, $annotation);
                $metadata->setDocumentValue($document, $documentProperty, $value);
            }
        }

        if ($document instanceof Proxy) {
            $document->__setInitialized(true);
        }

        return $document;
    }
1294102
public function getUrl($document)
    {
        $environment = $document->getEnvironment();

        return $environment->getUrl() . '.' . $this->kernel->getFileExtension();
    }
25566
protected function getDocumentBody( array $document )
    {
        if ( strpos( $document['Content-Type'], 'application/json' ) === 0 )
        {
            $source = json_decode( $document['body'], true );
            unset( $source['_rev'] );
            return json_encode( $source );
        }

        if ( is_array( $document['body'] ) )
        {
            $main   = array_shift( $document['body'] );
            $source = json_decode( $main['body'], true );
            unset( $source['_rev'] );

            $source['_attachments'] = array();
            foreach ( $document['body'] as $attachment )
            {
                $source['_attachments'][$attachment['Content-ID']] = array(
                    'content_type' => $attachment['Content-Type'],
                    'data'         => base64_encode( $attachment['body'] ),
                );
            }

            return json_encode( $source );
        }

        throw new phpillowMultipartParserException( "Invalid document: " . var_export( $document, true ) );
    }
1177660
private static function getCleanedHTML(DOMDocument $doc, $container)
    {
        while ($doc->firstChild) {
            $doc->removeChild($doc->firstChild);
        }

        while ($container->firstChild ) {
            $doc->appendChild($container->firstChild);
        }

        $html = trim($doc->saveHTML());
        return $html;
    }
702096
public function getXmlSigned(DocumentInterface $document)
    {
        $xml = $this->builder->build($document);

        $this->lastXml = $this->signer->signXml($xml);

        return $this->lastXml;
    }
1287281
protected function scrapeAndKneadImages( \DOMDocument $doc ) {

		$images = $doc->getElementsByTagName( 'img' );
		foreach ( $images as $image ) {
			/** @var \DOMElement $image */
			// Fetch image, change src
			$old_src = $image->getAttribute( 'src' );
			$new_src = $this->fetchAndSaveUniqueImage( $old_src );
			if ( $new_src ) {
				// Replace with new image
				$image->setAttribute( 'src', $new_src );
			} else {
				// Tag broken image
				$image->setAttribute( 'src', "{$old_src}#fixme" );
			}
		}

		return $doc;
	}
497555
public function convert(DOMDocument $document)
    {
        $this->processTag($document, 'ezembed', false);
        $this->processTag($document, 'ezembedinline', true);

        return $document;
    }
1198171
protected function getStateFormatted(Document $document) 
	{
		switch($document->getState()) {
			case Document::DOCUMENT_STATE_ACTIVE:
				$this->stateClass = 'success';
				return 'Attivo';
				break;
			case Document::DOCUMENT_STATE_DEACTIVE:
				$this->stateClass = 'warning';
				return 'Disattivo';
				break;
			case Document::DOCUMENT_STATE_DELETED:
				$this->stateClass = 'danger';
				return 'Eliminato';
				break;
		}

		$this->stateClass = 'danger';
		return 'Error with document state';
	}
598401
public function getDocumentActualData($document)
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        $actualData = array();
        foreach ($class->reflFields as $name => $refProp) {
            $mapping = $class->fieldMappings[$name];
            // skip not saved fields
            if (isset($mapping['notSaved']) && $mapping['notSaved'] === true) {
                continue;
            }
            $value = $refProp->getValue($document);
            if (isset($mapping['file']) && ! $value instanceof GridFSFile) {
                $value = new GridFSFile($value);
                $class->reflFields[$name]->setValue($document, $value);
                $actualData[$name] = $value;
            } elseif ((isset($mapping['association']) && $mapping['type'] === 'many')
                && $value !== null && ! ($value instanceof PersistentCollection)) {
                // If $actualData[$name] is not a Collection then use an ArrayCollection.
                if ( ! $value instanceof Collection) {
                    $value = new ArrayCollection($value);
                }

                // Inject PersistentCollection
                $coll = new PersistentCollection($value, $this->dm, $this);
                $coll->setOwner($document, $mapping);
                $coll->setDirty( ! $value->isEmpty());
                $class->reflFields[$name]->setValue($document, $coll);
                $actualData[$name] = $coll;
            } else {
                $actualData[$name] = $value;
            }
        }
        return $actualData;
    }
568883
public function insert(&$document) {

        if (isset($document[0])) {

            $this->database->connection->beginTransaction();

            foreach ($document as &$doc) {

                if (!\is_array($doc)) continue;

                $res = $this->_insert($doc);

                if (!$res) {
                    $this->database->connection->rollBack();
                    return $res;
                }
            }
            $this->database->connection->commit();
            return \count($document);
        } else {
            return $this->_insert($document);
        }
    }
326847
public function getXmlSigned(DocumentInterface $document)
    {
        $classDoc = get_class($document);

        return $this->factory
            ->setBuilder($this->getBuilder($classDoc))
            ->getXmlSigned($document);
    }
1177338
public function parseDocument(\DOMDocument $document)
    {
        foreach ($this->registry[DocumentExtension::class] as $extension) {
            $doc = $extension->parseDocument($this, $document);
            if ($doc) {
                return $doc;
            }
        }

        return null;
    }
797495
public static function getDocumentCompany($document)
    {
        return $document->getDataValue('firma') ? \FlexiPeeHP\FlexiBeeRO::uncode(
                $document->getDataValue('firma')) : null;
    }