Compiles the Doctrine proxy class code using the Doctrine ProxyFactory.

@return void
@throws FilesException
491376
public function compileProxies()
    {
        Files::emptyDirectoryRecursively(Files::concatenatePaths([$this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies']));
        /** @var \Doctrine\ORM\Proxy\ProxyFactory $proxyFactory */
        $proxyFactory = $this->entityManager->getProxyFactory();
        $proxyFactory->generateProxyClasses($this->entityManager->getMetadataFactory()->getAllMetadata());
    }
1121110
protected function compileAllFiles(){
        $preloader = new ClassPreloader(new PrettyPrinter, new Parser(new Lexer), $this->getTraverser());


        $handle = $preloader->prepareOutput($this->getContainer()->getCompiledPath());
        foreach ($this->getAllFiles() as $file) {
            try {
                fwrite($handle, $preloader->getCode($file, false)."\n");
            } catch (SkipFileException $ex) {
                //
            }
        }

        fclose($handle);
    }
879392
public function compile()
  {
    if (!$this->enabled || $this->env !== "dev") {
      return;
    }
    foreach ($this->watchers as $name => $watcher) {
      if (isset($this->configs[$name])) {
        foreach ($this->configs[$name] as $configPath) {
          $files = $watcher->getChildren($configPath);
          if ($this->cache->isFresh($configPath, $files)) {
            $watcher->compile($configPath);
            $this->cache->write($configPath, $files);
          }
        }
      }
    }
  }
655835
public static function init()
    {
        // Instantiate the application
        $app = Application::fromCwd();

        // Give proxies an instance of the application
        $app->initializeProxies();

        // Boot the app
        $app->boot();

        static::$appPath = \App::appPath();
        static::$vendorPath = \App::vendorPath();

        if (defined('COMPILING')) {
            static::$appPath = BUILD_PATH.'/app';
            static::$vendorPath = BUILD_PATH.'/vendor';
        }
    }
910043
public function compile()
    {
        $pharFilePath = dirname(__FILE__).'/../../build/packagist-security-checker.phar';

        if (file_exists($pharFilePath)) {
            unlink($pharFilePath);
        }

        $phar = new Phar($pharFilePath, 0, 'packagist-security-checker.phar');
        $phar->setSignatureAlgorithm(\Phar::SHA1);

        $phar->startBuffering();

        $this
            ->addPHPFiles($phar)
            ->addVendorFiles($phar)
            ->addComposerVendorFiles($phar)
            ->addBin($phar)
            ->addStub($phar)
            ->addLicense($phar);

        $phar->stopBuffering();

        unset($phar);
    }
1272290
public function generate(): string
    {
        $namespace = $this->reflectionClass->getNamespaceName();
        $fileDirectory = \rtrim($this->directory, '/') . '/Proxy/' . \str_replace('\\', '/', $namespace);
        $fileName = $this->reflectionClass->getShortName() . 'Proxy.php';
        $filePath = $fileDirectory . '/' . $fileName;

        if (!\is_dir($fileDirectory)) {
            // Try create directory
            if (false === @\mkdir($fileDirectory, 0777, true)) {
                throw new \RuntimeException(sprintf(
                    'Could not create directory "%s" for proxy file. Maybe not rights?',
                    $fileDirectory
                ));
            }
        } else if (!\is_writable($fileDirectory)) {
            throw new \RuntimeException(sprintf(
                'Cannot write to "%s" directory for save proxy file.',
                $fileDirectory
            ));
        }

        // Create file
        if (false === @\touch($filePath)) {
            throw new \RuntimeException(sprintf(
                'Could not create file "%s" for proxy class. Maybe not rights?',
                $filePath
            ));
        }

        \file_put_contents($filePath, $this->codeGenerator->generate());

        return $filePath;
    }
1251109
public function compile()
    {
        $container = $this->container->getContainer();
        foreach ($container as $dependencyIndex => $dependency) {
            $code = $this->dependencyCompiler->getCode($dependency);
            ($this->dependencySaver)($dependencyIndex, $code);
        }
        $this->savePointcuts($this->container);
        \file_put_contents($this->scriptDir . ScriptInjector::MODULE, \serialize($this->module));
    }
218585
public function compile()
	{
	
		if ($this->multiSource)
		{
			$multiSRC = \StringUtil::deserialize($this->data->multiSRC);
			
			// Return if there are no files
			if (!is_array($multiSRC) || empty($multiSRC))
			{
				return '';
			}
			
			$objFiles = \FilesModel::findMultipleByUuids($multiSRC);			
		}
		else
		{
			// Return if there is no file
			if ($this->data->singleSRC == '')
			{
				return '';
			}
		
			$objFiles = \FilesModel::findMultipleByUuids(array($this->data->singleSRC));
		}

		if ($objFiles === null)
		{
			if (!\Validator::isUuid($multiSRC[0]))
			{
				return '<p class="error">'.$GLOBALS['TL_LANG']['ERR']['version2format'].'</p>';
			}
			return '';
		}
		
		$file = \Input::get('file', true);
		
		// Send the file to the browser and do not send a 404 header (see #4632)
		if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\.txt$/', basename($file)))
		{
			while ($objFiles->next())
			{
				if ($file == $objFiles->path || dirname($file) == $objFiles->path)
				{
					\Controller::sendFileToBrowser($file);
				}
			}
			$objFiles->reset();
		}
		
		global $objPage;
		
		$allowedDownload = \StringUtil::trimsplit(',', strtolower(\Config::get('allowedDownload')));
		$allowedVideo = \StringUtil::trimsplit(',', strtolower(\Config::get('validVideoTypes')));
		$allowedAudio = \StringUtil::trimsplit(',', strtolower(\Config::get('validAudioTypes')));
		
		$files = array();
		$auxDate = array();

		// Get all files
		while ($objFiles->next())
		{
			// Continue if the files has been processed or does not exist
			if (isset($files[$objFiles->path]) || !file_exists(TL_ROOT . '/' . $objFiles->path))
			{
				continue;
			}
			
			// Single files
			if ($objFiles->type == 'file')
			{
				$objFile = new \File($objFiles->path, true);
				
				switch ($this->source)
				{
					case 'image':
						if (!$objFile->isImage)
						{
							continue 2;
						}
						break;
						
					case 'video':
						if (!in_array($objFile->extension, $allowedVideo))
						{
							continue 2;
						}
						break;
					
					case 'audio':
						if (!in_array($objFile->extension, $allowedAudio))
						{
							continue 2;
						}
						break;
					
					default:
						if ((!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\.txt$/', $objFile->basename)))
						{
							continue 2;
						}
					break;
				}

				
				$arrMeta = \Frontend::getMetaData($objFiles->meta, $objPage->language);
				
				if (empty($arrMeta))
				{
					if ($this->metaIgnore)
					{
						continue;
					}
					elseif ($objPage->rootFallbackLanguage !== null)
					{
						$arrMeta = \Frontend::getMetaData($objFiles->meta, $objPage->rootFallbackLanguage);
					}
				}
				
				// Use the file name as title if none is given
				if ($arrMeta['title'] == '')
				{
					$arrMeta['title'] = \StringUtil::specialchars($objFile->basename);
				}

				$strHref = \Environment::get('request');
				
				// Remove an existing file parameter (see #5683)
				if (preg_match('/(&(amp;)?|\?)file=/', $strHref))
				{
					$strHref = preg_replace('/(&(amp;)?|\?)file=[^&]+/', '', $strHref);
				}
				
				$strHref .= ((\Config::get('disableAlias') || strpos($strHref, '?') !== false) ? '&amp;' : '?') . 'file=' . \System::urlEncode($objFiles->path);
				
				
				// Add the file
				$files[$objFiles->path] = array
				(
					'id'        => $objFiles->id,
					'uuid'      => $objFiles->uuid,
					'name'      => $objFile->basename,
					'path' 		=> $objFiles->path,
					'size'		=> ($this->canChangeSize) ? $this->data->size : $this->size,
					'alt'       => $arrMeta['title'],
					'title'     => $arrMeta['title'],
					'imageUrl'  => $arrMeta['link'],
					'caption'   => $arrMeta['caption'],
					'href'      => $strHref,
					'filesize'  => $this->getReadableSize($objFile->filesize, 1),
					'icon'      => TL_ASSETS_URL . 'assets/contao/images/' . $objFile->icon,
					'mime'      => $objFile->mime,
					'extension' => $objFile->extension
				);
				
				$auxDate[] = $objFile->mtime;
			}
			
			// Folders
			else
			{
				$objSubfiles = \FilesModel::findByPid($objFiles->uuid);
				
				if ($objSubfiles === null)
				{
					continue;
				}
				
				while ($objSubfiles->next())
				{
					// Skip subfolders
					if ($objSubfiles->type == 'folder')
					{
						continue;
					}
				
					$objFile = new \File($objSubfiles->path, true);
					
					switch ($this->source)
					{
						case 'image':
							if (!$objFile->isImage)
							{
								continue 2;
							}
							break;
						
						case 'video':
							if (!in_array($objFile->extension, $allowedVideo))
							{
								continue 2;
							}
							break;
						
						case 'audio':
							if (!in_array($objFile->extension, $allowedAudio))
							{
								continue 2;
							}
							break;
					
						default:
							if ((!in_array($objFile->extension, $allowedDownload) || preg_match('/^meta(_[a-z]{2})?\.txt$/', $objFile->basename)))
							{
								continue 2;
							}
						break;
					}
					
					$arrMeta = \Frontend::getMetaData($objSubfiles->meta, $objPage->language);
					
					if (empty($arrMeta))
					{
						if ($this->metaIgnore)
						{
							continue;
						}
						elseif ($objPage->rootFallbackLanguage !== null)
						{
							$arrMeta = \Frontend::getMetaData($objSubfiles->meta, $objPage->rootFallbackLanguage);
						}
					}
					
					// Use the file name as title if none is given
					if ($arrMeta['title'] == '')
					{
						$arrMeta['title'] = \StringUtil::specialchars($objFile->basename);
					}

					$strHref = \Environment::get('request');
					
					// Remove an existing file parameter (see #5683)
					if (preg_match('/(&(amp;)?|\?)file=/', $strHref))
					{
						$strHref = preg_replace('/(&(amp;)?|\?)file=[^&]+/', '', $strHref);
					}
					
					$strHref .= ((\Config::get('disableAlias') || strpos($strHref, '?') !== false) ? '&amp;' : '?') . 'file=' . \System::urlEncode($objSubfiles->path);

					
					// Add the file
					$files[$objSubfiles->path] = array
					(
						'id'        => $objSubfiles->id,
						'uuid'      => $objSubfiles->uuid,
						'name'      => $objSubfiles->basename,
						'path' 		=> $objSubfiles->path,
						'size'		=> ($this->canChangeSize) ? $this->data->size : $this->size,
						'alt'       => $arrMeta['title'],
						'title'     => $arrMeta['title'],
						'imageUrl'  => $arrMeta['link'],
						'caption'   => $arrMeta['caption'],
						'href'      => $strHref,
						'filesize'  => $this->getReadableSize($objSubfiles->filesize, 1),
						'icon'      => TL_ASSETS_URL . 'assets/contao/images/' . $objSubfiles->icon,
						'mime'      => $objSubfiles->mime,
						'extension' => $objSubfiles->extension
					);
					
					$auxDate[] = $objSubfiles->mtime;
				}
			}
		}
		
		// Sort array
		switch (($this->canChangeSortBy) ? $this->data->sortBy : $this->sortBy)
		{
			default:
			case 'name_asc':
				uksort($files, 'basename_natcasecmp');
				break;
			
			case 'name_desc':
				uksort($files, 'basename_natcasercmp');
				break;
			
			case 'date_asc':
				array_multisort($files, SORT_NUMERIC, $auxDate, SORT_ASC);
				break;
			
			case 'date_desc':
				array_multisort($files, SORT_NUMERIC, $auxDate, SORT_DESC);
				break;
			
			case 'custom':
				if ($this->data->orderSRC != '')
				{
					$tmp = \StringUtil::deserialize($this->data->orderSRC);
				
					if (!empty($tmp) && is_array($tmp))
					{
						// Remove all values
						$arrOrder = array_map(function(){}, array_flip($tmp));
						
						// Move the matching elements to their position in $arrOrder
						foreach ($files as $k=>$v)
						{
							if (array_key_exists($v['uuid'], $arrOrder))
							{
								$arrOrder[$v['uuid']] = $v;
								unset($files[$k]);
							}
						}
						
						// Append the left-over files at the end
						if (!empty($files))
						{
							$arrOrder = array_merge($arrOrder, array_values($files));
						}
							
						// Remove empty (unreplaced) entries
						$files = array_values(array_filter($arrOrder));
						
						unset($arrOrder);
					}
				}
				break;
			
			case 'random':
				shuffle($files);
				break;

			case 'html5media':
				// Pre-sorted array for recommended html4 video and audio order
				$arrOrder = array('mp4'=>null, 'm4v'=>null, 'mov'=>null, 'wmv'=>null, 'webm'=>null, 'ogv'=>null, 'm4a'=>null, 'mp3'=>null, 'wma'=>null, 'mpeg'=>null, 'wav'=>null, 'ogg'=>null);
				
				foreach ($files as $file)
				{
					if (!is_array($arrOrder[$file['extension']]))
					{
						$arrOrder[$file['extension']] = $file;
					}
					
				}

				// Remove empty (unreplaced) entries
				$files = array_values(array_filter($arrOrder));

				break;
		}

		$files = array_values($files);
		
		// Limit the total number of items
		if ($this->numberOfItems > 0)
		{
			$files = array_slice($files, 0, $this->numberOfItems);
		}
		
		// Prepare images
		if ($this->source == 'image')
		{
			$pictures = array();
			foreach ($files as $key=>$image)
			{
				$image['singleSRC'] = $image['path'];
				
				$this->addImageToTemplate($pictures[$key] = new \stdClass(), $image);	
				
				$pictures[$key] = $pictures[$key]->picture;
				$pictures[$key]['imageUrl'] = $image['imageUrl'];
				$pictures[$key]['caption'] = $image['caption'];
				$pictures[$key]['id'] = $image['id'];
				$pictures[$key]['uuid'] = $image['uuid'];
				$pictures[$key]['name'] = $image['name'];
				$pictures[$key]['path'] = $image['path'];
				$pictures[$key]['extension'] = $image['extension'];
			}
			
			$files = $pictures;
		}
		
		// no collection array for single source
		if (!$this->multiSource)
		{
			$files = $files[0];
		}

		$this->writeToTemplate($files);
	}
506491
public function createProxy($class, &$proxyFile = null)
    {
        $proxyClass = $this->getProxyClass($class);
        $class      = '\\'.rtrim($class, '\\');
        $proxyFile  = $this->proxyDirectory.'/'.$proxyClass.'.php';

        if (class_exists($proxyClass)) {
            return $proxyClass;
        }

        if (file_exists($proxyFile)) {
            require $proxyFile;

            return $proxyClass;
        }

        $content = file_get_contents(dirname(__DIR__).'/Resources/proxy/template.php');
        $content = str_replace('__TPL_CLASS__', $proxyClass, $content);
        $content = str_replace('__TPL_EXTENDS__', $class, $content);

        $this->checkProxyDirectory();
        file_put_contents($proxyFile, $content);
        require $proxyFile;

        return $proxyClass;
    }
937355
protected function compile()
    {
        $this->headers = array_merge(
            $this->csp(),
            $this->featurePolicy(),
            $this->hpkp(),
            $this->hsts(),
            $this->expectCT(),
            $this->clearSiteData(),
            $this->miscellaneous()
        );

        $this->compiled = true;
    }
567503
public function compile(Compiler $compiler): void
    {
        $runtimeErrorClass = RuntimeError::class;
        $suppressedExceptionClass = SuppressedException::class;

        $compiler
            ->write("try {\n")
            ->indent()
            ->write("ob_start();\n\n")
            ->subcompile($this->getNode('body'))
            ->raw("\n")
            ->write("echo ob_get_clean();\n")
            ->outdent()
            ->write("} catch ({$runtimeErrorClass} \$exception) {\n")
            ->indent()
            ->write("ob_end_clean();\n\n")
            ->write("if (\$exception->getPrevious() === null) {\n")
            ->indent()
            ->write("throw \$exception;\n")
            ->outdent()
            ->write("}\n\n")
            ->write("\$suppressedException = new {$suppressedExceptionClass}(\$exception->getPrevious());\n")
            ->outdent()
            ->write("}\n\n");
    }
511195
public function compileFunction(CompilationContext $compilationContext, FunctionDefinition $functionDefinition)
    {
        /** Make sure we do not produce calls like ZEPHIR_CALL_SELF */
        $bakClassDefinition = $compilationContext->classDefinition;
        $compilationContext->classDefinition = null;
        $compilationContext->currentMethod = $functionDefinition;

        $codePrinter = $compilationContext->codePrinter;
        $codePrinter->output('PHP_FUNCTION('.$functionDefinition->getInternalName().') {');
        $functionDefinition->compile($compilationContext);
        $codePrinter->output('}');
        $codePrinter->outputBlankLine();

        /* Restore */
        $compilationContext->classDefinition = $bakClassDefinition;
        $compilationContext->currentMethod = null;
    }
1306924
protected function compileClasses()
	{
		$this->registerClassPreloaderCommand();

		$outputPath = $this->laravel['path.storage'] . '/compiled.php';

		$this->callSilent('compile', array(
			'--config'         => implode(',', $this->getClassFiles()),
			'--output'         => $outputPath,
			'--strip_comments' => 1,
		));
	}
445561
public function loadProxyClass()
    {
        if (!$this->cacheFileExists() || $this->debug) {
            $this->writeProxyClassCache();
        }

        if (!$this->isProxyLoaded()) {
            require $this->proxyClassCacheFilename;
        }

        return $this;
    }
974173
public function compile()
    {
        // Path prefix
        $prefix = $this->getNewPrefix();
        // List of images
        $data = $this->getList();

        // sizes
        $sizes = [];
        foreach ($this->providers as $provider) {
            if ($provider instanceof SizeProviderInterface) {
                $sizes = array_merge($sizes, $provider->getSizes());
            }
        }

        $num = 0;
        $scss = [];
        foreach ($data as $name => $list) {
            // Sprite size
            $size = !isset($sizes[$name]) ? null : $sizes[$name];
            $size = $this->getSize($name, $size);
            if (is_array($size)) {
                $border = $size[1];
                $sizeH = isset($size[2]) ? $size[2] : $size[0];
                $sizeW = $size[0];
            } else {
                $border = static::BORDER_WIDTH;
                $sizeH = $sizeW = $size;
            }
            $scss[] = $this->compileFile($prefix, $name, $list, [$sizeW, $sizeH], $border);
            $num += count($list);
        }

        // Populating template
        $template = file_get_contents($this->template);
        $scss = str_replace(
            static::TEMPLATE_NEEDLE, join("\n", $scss), $template
        );

        // Creating global classes
        if (static::CREATE_CLASSES) {
            foreach ($data as $name => $list) {
                $scss .= '.#{$' . static::NAMESPACE_NAME . '}';
                $scss .= ', .#{$' . static::NAMESPACE_NAME . '}-' . $name . ' {' . "\n";
                $scss .= '@include ' . static::PREFIX_SPRITE . $name . ';' . "\n";
                $scss .= '};' . "\n";
            }
        }

        // Writing the file
        file_put_contents($this->stylePath, $scss);

        return $num;
    }
164083
public function beforeCompile(): void
	{
		// Skip if it's not CLI mode
		if (!$this->cliMode) return;

		$builder = $this->getContainerBuilder();

		// Lookup for Symfony Console Application
		$application = $builder->getDefinitionByType('Symfony\Component\Console\Application');

		// Register helpers
		$connectionHelper = $this->prefix('@connectionHelper');
		$application->addSetup(new Statement('$service->getHelperSet()->set(?, ?)', [$connectionHelper, 'db']));
	}
1062255
public function compile(CompilationContext $compilationContext)
    {
        $expression = [
            'type' => 'require',
            'left' => $this->statement['expr'],
            'file' => $this->statement['file'],
            'line' => $this->statement['line'],
            'char' => $this->statement['char'],
        ];

        $expr = new Expression($expression);
        $expr->setExpectReturn(false, null);
        $expr->compile($compilationContext);
    }