Prepare a PO file before output by adding headers to it.

@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param tao_helpers_translation_POFile $poFile
@param bool $poEditorReady
@return void
764279
public function preparePOFile( tao_helpers_translation_POFile $poFile, $poEditorReady = false)
    {
        
        $poFile->addHeader('Project-Id-Version', PRODUCT_NAME . ' ' . ApplicationHelper::getVersionName());
        $poFile->addHeader('PO-Revision-Date', date('Y-m-d') . 'T' . date('H:i:s'));
        $poFile->addHeader('Last-Translator', 'TAO Translation Team <translation@tao.lu>');
        $poFile->addHeader('MIME-Version', '1.0');
        $poFile->addHeader('Language', $poFile->getTargetLanguage());
        $poFile->addHeader('sourceLanguage', $poFile->getSourceLanguage());
        $poFile->addHeader('targetLanguage', $poFile->getTargetLanguage());
        $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
        $poFile->addHeader('Content-Transfer-Encoding', '8bit');

		if ($poEditorReady) {
			$poFile->addHeader('X-Poedit-Basepath', '../../');
			$poFile->addHeader('X-Poedit-KeywordsList', '__');
			$poFile->addHeader('X-Poedit-SearchPath-0', '.');
		}
    }
1349972
function init (file) {
  if (!postcssify.entry) {
    if (dest) {
      log.info('output: %s', dest)
      process.on('beforeExit', () => {
        if (!postcssify.complete) {
          postcssify.complete = true
          bundle()
        }
      })
      postcssify.entry = file
    } else {
      return
    }
  }
  return true
}
448473
public function prepare(Location $location)
    {
        if (!$this->formatter) {
            throw new BuildException("No formatter specified (use type or classname attribute)", $location);
        }

        $out = $this->getOutputWriter();

        $this->parentTask->log("Setting output writer to: " . get_class($out), Project::MSG_VERBOSE);
        $this->formatter->setOutput($out);

        if ($this->formatter instanceof PlainPDOResultFormatter) {
            // set any options that apply to the plain formatter
            $this->formatter->setShowheaders($this->showheaders);
            $this->formatter->setRowdelim($this->rowdelimiter);
            $this->formatter->setColdelim($this->coldelimiter);
        } elseif ($this->formatter instanceof XMLPDOResultFormatter) {
            // set any options that apply to the xml formatter
            $this->formatter->setEncoding($this->encoding);
            $this->formatter->setFormatOutput($this->formatoutput);
        }

        foreach ($this->formatterParams as $param) {
            $param = new Parameter();
            $method = 'set' . $param->getName();
            if (!method_exists($this->formatter, $param->getName())) {
                throw new BuildException(
                    "Formatter " . get_class(
                        $this->formatter
                    ) . " does not have a $method method.",
                    $location
                );
            }
            call_user_func([$this->formatter, $method], $param->getValue());
        }
    }
852095
def __prepare(self, filestem, pos, neg, b):
        
        posFile = open('%s/%s.f' % (self.tmpdir, filestem), 'w')
        negFile = open('%s/%s.n' % (self.tmpdir, filestem), 'w')
        bFile = open('%s/%s.b' % (self.tmpdir, filestem), 'w')

        posFile.write(pos)
        negFile.write(neg)
        bFile.write(b)

        posFile.close()
        negFile.close()
        bFile.close()
1022884
protected function prepare()
    {
        //Force passice mode if not specified
        $this->addOption('passive', true);

        //To make call on different files, we must retrieve the root and apply commands to the path
        $tmp = clone $this->getUrl();
        $tmp->path('');
        $this->addOption('url', $tmp->toString());
    }
673588
protected function prepare()
    {
        parent::prepare();

        if (!$this->hasBodyStream()) {
            if (false === $stream = tmpfile()) {
                throw new RuntimeException("Can't create temporary file.");
            }
            fwrite($stream, $this->getBody());
            rewind($stream);
            $this->setBody($stream);
        }

        $this->addOption('url', $this->getUrl());
        $this->addOption('upload', true);
        $this->addOption('body', $this->getBody());
    }
881455
private function prepEntity(TokenEntity $tokenEntity, ProfileEntity $profileEntity) {
        if(!$tokenEntity->issuer_url && $profileEntity->issuer_url) {
            $tokenEntity->issuer_url = $profileEntity->issuer_url;
            //$tokenEntity->issuer_url = EnvService::getUrl(API, 'v1/auth');
        }
        /*$userId = ArrayHelper::getValue($tokenEntity, 'subject.id');
        if($userId) {
            if(!$tokenEntity->subject_url) {
                $tokenEntity->subject_url = EnvService::getUrl(API, 'v1/user/' . $userId);
            }
        }*/
    }
406167
public function make($file, $content, $recursive = false)
    {
        if ($this->exists($this->getPath($file))) {
            throw new FileAlreadyExists;
        }
        $this->put($file, $content, 0, $recursive);
    }
346589
protected function prepareData()
    {
        if ($this->prepared) {
            return;
        }

        $this->presences         = new Collection;
        $this->modulePresences   = new Collection;
        $this->permissions       = [];
        $this->modulePermissions = [];

        $this->loadAclModules()
             ->collapsePermissions();

        $this->prepared = true;
    }
802999
public function prependAlternate($href, $type, $title, $media = null, $conditional = '')
    {
        return $this->_setAlternate($href, $type, $title, $media, false, $conditional);
    }
966494
protected function prepare()
    {
        $this->initPurifier($this->config->getPurifierCacheLocation());

        $this->oldText = $this->purifyHtml($this->oldText);
        $this->newText = $this->purifyHtml($this->newText);
    }
524786
protected void addPOEntry(final String tag, final String source, final String translation, final boolean fuzzy,
            final StringBuilder poFile) {
        // perform a check to make sure the source isn't an empty string, as this could be the case after removing the comments
        if (source == null || source.length() == 0) return;

        poFile.append("\n");
        if (!isNullOrEmpty(tag)) {
            poFile.append("#. Tag: ").append(tag).append("\n");
        }
        if (fuzzy) {
            poFile.append("#, fuzzy\n");
        }
        poFile.append("#, no-c-format\n")
                .append("msgid \"").append(escapeForPOFile(source, true)).append("\"\n")
                .append("msgstr \"").append(escapeForPOFile(translation, false)).append("\"\n");
    }
229580
public function prepare() {

		$object_type = $this->getObjectType();

		$object_link = elgg_view('output/url', array(
			'text' => $this->object->getDisplayName(),
			'href' => elgg_http_add_url_query_elements($this->object->getURL(), array(
				'active_tab' => 'comments',
			)),
		));

		if ($this->author->guid == $this->object->owner_guid) {
			$object_summary_title = elgg_echo('interactions:ownership:own', array($object_type), $this->language);
		} else if ($this->recipient->guid == $this->object->owner_guid) {
			$object_summary_title = elgg_echo('interactions:ownership:your', array($object_type), $this->language);
		} else {
			$object_owner = $this->object->getOwnerEntity() ? : elgg_get_site_entity();
			$object_summary_title = elgg_echo('interactions:ownership:owner', array($object_owner->getDisplayName(), $object_type), $this->language);
		}

		if ($this->object instanceof Comment) {
			$object_full_title = $object_summary_title;
		} else {
			$object_full_title = $object_summary_title . ' ' . $object_link;
		}

		if ($this->root->guid !== $this->object->guid) {
			$root_link = elgg_view('output/url', array(
				'text' => $this->root->getDisplayName(),
				'href' => elgg_http_add_url_query_elements($this->root->getURL(), array(
					'active_tab' => 'comments',
				)),
			));
			$object_full_title .= ' ' . elgg_echo('interactions:comment:in_thread', array($root_link));
		}

		$author_link = elgg_view('output/url', array(
			'text' => $this->author->name,
			'href' => $this->author->getURL(),
		));

		$object_summary_link = elgg_view('output/url', array(
			'text' => $object_summary_title,
			'href' => elgg_http_add_url_query_elements($this->object->getURL(), array(
				'active_tab' => 'comments',
			)),
		));

		$action_type = $this->getActionType();

		$notification = new \stdClass();
		$notification->summary = elgg_echo('interactions:response:email:subject', array(
			$author_link,
			$action_type,
			$object_summary_link
				), $this->language);
		$notification->subject = strip_tags($notification->summary);
		$notification->body = elgg_echo('interactions:response:email:body', array(
			$author_link,
			$action_type,
			$object_full_title,
			$this->getComment(),
			$this->comment->getURL(),
			$this->root->getURL(),
			$this->author->getDisplayName(),
			$this->author->getURL(),
				), $this->language);

		return $notification;
	}
715258
public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');
        if (isset($bundles['DoctrineBundle'])) {
            // Get configuration of our own bundle
            $configs = $container->getExtensionConfig($this->getAlias());
            $config = $this->processConfiguration(new Configuration(), $configs);

            $edTargetEntities = array(
                'ED\BlogBundle\Interfaces\Model\BlogUserInterface' => $config['entities']['user_model_class'],
                'ED\BlogBundle\Interfaces\Model\BlogTermInterface' => $config['entities']['blog_term_class'],
                'ED\BlogBundle\Interfaces\Model\BlogTaxonomyInterface' => $config['entities']['blog_taxonomy_class'],
                'ED\BlogBundle\Interfaces\TaxonomyRelationsInterface' => $config['entities']['blog_taxonomy_relation_class'],
                'ED\BlogBundle\Interfaces\Model\ArticleInterface' => $config['entities']['article_class'],
                'ED\BlogBundle\Interfaces\Model\CommentInterface' => $config['entities']['blog_comment_class'],
                'ED\BlogBundle\Interfaces\Model\ArticleCommenterInterface' => $config['entities']['user_model_class'],
                'ED\BlogBundle\Interfaces\Model\ArticleMetaInterface' => $config['entities']['article_meta_class']
            );

            // Prepare for insertion
            $forInsertion = array(
                'orm' => array(
                    'resolve_target_entities' => $edTargetEntities,
                    'entity_managers' => array(
                        'default' => array(
                            'hydrators' => array(
                                'SettingsHydrator' => $config['hydrators']['settings_hydrator']
                            )
                        )
                    )
                ),
                'dbal' => array(
                    'types' => array(
                        'json' => 'Sonata\Doctrine\Types\JsonType'
                    )
                )
            );

            $container->setParameter('user_model_class', $config['entities']['user_model_class']);
            $container->setParameter('article_class', $config['entities']['article_class']);
            $container->setParameter('blog_comment_class', $config['entities']['blog_comment_class']);
            $container->setParameter('article_meta_class', $config['entities']['article_meta_class']);
            $container->setParameter('blog_settings_class', $config['entities']['blog_settings_class']);
            $container->setParameter('blog_taxonomy_class', $config['entities']['blog_taxonomy_class']);
            $container->setParameter('blog_term_class', $config['entities']['blog_term_class']);
            $container->setParameter('ed_blog.resolve_target_entities.config', $edTargetEntities);

        }

        if(isset($bundles['StofDoctrineExtensionsBundle'])) {
            $configs = $container->getExtensionConfig($this->getAlias());
            $config = $this->processConfiguration(new Configuration(), $configs);

            $stofConfigInsertation = array(
                'orm' => array(
                    'default' => array(
                        'sluggable' => true
                    )
                )
            );

        }


        foreach ($container->getExtensions() as $name => $extension) {
            switch ($name) {
                case 'doctrine':
                    if(isset($forInsertion)) {
                        $container->prependExtensionConfig($name, $forInsertion);
                    }
                    break;
                case 'stof_doctrine_extensions':
                    if(isset($stofConfigInsertation)){
                        $container->prependExtensionConfig($name, $stofConfigInsertation);
                    }
                    break;
            }
        }
    }
1253366
public function prepare()
  {
    $initFile=$this->basePath . DIRECTORY_SEPARATOR . $this->initScript;

    $this->checkIntegrity(false); //not supported in sqlite

    if(is_file($initFile))
      require($initFile);
    else
    {
      foreach($this->getFixtures() as $tableName=>$fixturePath)
      {
        $this->resetTable($tableName);
        $this->loadFixture($tableName);
      }
    }
    $this->checkIntegrity(true); //not supported in sqlite
  }
781791
public function prepend()
    {
        $script = $this->parseArgs(func_get_args());
        if ($script !== false && !in_array($script, $this->members)) array_unshift($this->members, $script);
    }
861833
private function doBeforeCompile(): void
	{
		$builder = $this->getContainerBuilder();
		$dispatcher = $builder->getDefinition($this->prefix('dispatcher'));

		$subscribers = $builder->findByType(EventSubscriberInterface::class);
		foreach ($subscribers as $name => $subscriber) {
			$dispatcher->addSetup('addSubscriber', [$subscriber]);
		}
	}