plugin/drop-zone/Manager/DropzoneManager.php
public function executeTool(DropzoneTool $tool, Document $document)
    {
        if (DropzoneTool::COMPILATIO === $tool->getType() && Document::DOCUMENT_TYPE_FILE === $document->getType()) {
            $toolDocument = $this->dropzoneToolDocumentRepo->findOneBy(['tool' => $tool, 'document' => $document]);
            $toolData = $tool->getData();
            $compilatio = new \SoapClient($toolData['url']);

            if (empty($toolDocument)) {
                $documentData = $document->getFile();
                $params = [];
                $params[] = $toolData['key'];
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['mimeType']);
                $params[] = base64_encode(file_get_contents($this->filesDir.DIRECTORY_SEPARATOR.$documentData['url']));
                $idDocument = $compilatio->__call('addDocumentBase64', $params);
                $analysisParams = [];
                $analysisParams[] = $toolData['key'];
                $analysisParams[] = $idDocument;
                $compilatio->__call('startDocumentAnalyse', $analysisParams);
                $reportUrl = $compilatio->__call('getDocumentReportUrl', $analysisParams);

                if ($idDocument && $reportUrl) {
                    $this->createToolDocument($tool, $document, $idDocument, $reportUrl);
                }
            }
        }

        return $document;
    }
public function executeTool(DropzoneTool $tool, Document $document)
    {
        if (DropzoneTool::COMPILATIO === $tool->getType() && Document::DOCUMENT_TYPE_FILE === $document->getType()) {
            $toolDocument = $this->dropzoneToolDocumentRepo->findOneBy(['tool' => $tool, 'document' => $document]);
            $toolData = $tool->getData();
            $compilatio = new \SoapClient($toolData['url']);

            if (empty($toolDocument)) {
                $documentData = $document->getFile();
                $params = [];
                $params[] = $toolData['key'];
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['name']);
                $params[] = utf8_encode($documentData['mimeType']);
                $params[] = base64_encode(file_get_contents($this->filesDir.DIRECTORY_SEPARATOR.$documentData['url']));
                $idDocument = $compilatio->__call('addDocumentBase64', $params);
                $analysisParams = [];
                $analysisParams[] = $toolData['key'];
                $analysisParams[] = $idDocument;
                $compilatio->__call('startDocumentAnalyse', $analysisParams);
                $reportUrl = $compilatio->__call('getDocumentReportUrl', $analysisParams);

                if ($idDocument && $reportUrl) {
                    $this->createToolDocument($tool, $document, $idDocument, $reportUrl);
                }
            }
        }

        return $document;
    }
public function executeTool ( DropzoneTool $ tool , Document $ document ) { if ( DropzoneTool :: COMPILATIO === $ tool -> getType ( ) && Document :: DOCUMENT_TYPE_FILE === $ document -> getType ( ) ) { $ toolDocument = $ this -> dropzoneToolDocumentRepo -> findOneBy ( [ 'tool' => $ tool , 'document' => $ document ] ) ; $ toolData = $ tool -> getData ( ) ; $ compilatio = new \ SoapClient ( $ toolData [ 'url' ] ) ; if ( empty ( $ toolDocument ) ) { $ documentData = $ document -> getFile ( ) ; $ params = [ ] ; $ params [ ] = $ toolData [ 'key' ] ; $ params [ ] = utf8_encode ( $ documentData [ 'name' ] ) ; $ params [ ] = utf8_encode ( $ documentData [ 'name' ] ) ; $ params [ ] = utf8_encode ( $ documentData [ 'name' ] ) ; $ params [ ] = utf8_encode ( $ documentData [ 'mimeType' ] ) ; $ params [ ] = base64_encode ( file_get_contents ( $ this -> filesDir . DIRECTORY_SEPARATOR . $ documentData [ 'url' ] ) ) ; $ idDocument = $ compilatio -> __call ( 'addDocumentBase64' , $ params ) ; $ analysisParams = [ ] ; $ analysisParams [ ] = $ toolData [ 'key' ] ; $ analysisParams [ ] = $ idDocument ; $ compilatio -> __call ( 'startDocumentAnalyse' , $ analysisParams ) ; $ reportUrl = $ compilatio -> __call ( 'getDocumentReportUrl' , $ analysisParams ) ; if ( $ idDocument && $ reportUrl ) { $ this -> createToolDocument ( $ tool , $ document , $ idDocument , $ reportUrl ) ; } } } return $ document ; }
Executes a Tool on a Document.

@param DropzoneTool $tool
@param Document     $document

@return Document
Executes a Tool on a Document .