/** * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile() * @param bool $withSrc * @return int|bool */ public function writeFile($withSrc = true) { if (!$this->getModel() instanceof AbstractModel) { throw new \InvalidArgumentException('You MUST define the model before begin able to generate the file', __LINE__); } GeneratorUtils::createDirectory($this->getFileDestination($withSrc)); $this->defineNamespace()->defineUseStatement()->addAnnotationBlock()->addClassElement(); return parent::writeFile(); }
/** * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile() * @return int|bool */ public function writeFile() { $this->addMainAnnotationBlock()->addAutoload()->addOptionsAnnotationBlock()->addOptions()->addContent(); return parent::writeFile(); }
/** * @param string $valid * @param File $file */ protected function assertSameFileContent($valid, File $file, $fileExtension = 'php') { if (!is_file($file->getFileName())) { return $this->assertFalse(true, sprintf('Generated file "%s" could not be found', $file->getFileName())); } $validContent = file_get_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension)); $validContent = str_replace('__WSDL_URL__', $file->getGenerator()->getWsdl()->getName(), $validContent); $toBeValidatedContent = file_get_contents($file->getFileName()); $this->assertSame($validContent, $toBeValidatedContent); unlink($file->getFileName()); }