Prepare the packet

@return void
160780
final public function prepare($stanza, $parent = false)
    {
        if($parent === false) {
            $this->packet->from = current(explode('/',(string)$stanza->attributes()->from));
        } else {
            $this->packet->from = current(explode('/',(string)$parent->attributes()->from));
        }
    }
345819
public function prepare()
    {    
        if (!empty($this->module->templateTransCat)) {
            $this->tcModule = $this->module->tcModule;
            $this->tcModels = $this->module->tcModels;
            
            $id = Inflector::camel2id(basename($this->className()));
            $this->tc = str_replace('*', "/model-{$id}", $this->module->templateTransCat);
        }
        if (!empty($this->module->params['pageSize'])) {
            $this->pageSize = $this->module->params['pageSize'];
        }
    }
188664
public function prepare()
    {
        // The date format method to use with Carbon to convert the dates
        $dateFormatMethod = 'to' . strtolower($this->format) . 'String';

        if (null !== $this->pubDate) {
            $this->pubDate = Carbon::parse($this->pubDate)->{$dateFormatMethod}();
        }

        if (null !== $this->updated) {
            $this->updated = Carbon::parse($this->updated)->{$dateFormatMethod}();
        }

        $this->title = strip_tags($this->title);

        $this->autoFill();
    }
985568
protected function prepareInput()
    {
        if ($this->input instanceof Bag) {
            return;
        }

        $input = array();

        if ($_SERVER['REQUEST_METHOD'] == "POST") {

            $xmlInput = file_get_contents('php://input');

            $array = XML::parse($xmlInput);

            if (isset($array['Encrypt'])) {
                $this->encryptStr = $array['Encrypt'];
            }

            $input = $this->getCrypt()->decryptMsg(
                    $_REQUEST['msg_signature'],
                    $_REQUEST['nonce'],
                    $_REQUEST['timestamp'],
                    $xmlInput
                );
        }

        $this->input = new Bag(array_merge($_REQUEST, (array) $input));

    }
1118601
protected function prepare() {
		$c = CF::s($m = $this->m(), Card::create($m, $this->cardData())); /** @var CF $c */ /** @var M $m */
		$this->siID();
		$this->si($this->extended('Card Number', 'Number'), $c->label());
		$c->c()->owner() ? $this->siEx('Cardholder', $c->c()->owner()) : null;
		$this->siEx(['Card Expires' => $c->exp(), 'Card Country' => $c->country()]);
	}
487912
public function prepareForConsoleCommand()
    {
        $this->withFacades();

        $this->make('cache');
        $this->make('queue');

        $this->configure('database');

        $this->register('Illuminate\Queue\ConsoleServiceProvider');
    }
838730
public function prepare_package() {
        $entries = $this->exportdata['entries'];
        $aliases = array();
        $categories = array();
        if (is_array($this->exportdata['aliases'])) {
            foreach ($this->exportdata['aliases'] as $alias) {
                if (!array_key_exists($alias->entryid, $aliases)) {
                    $aliases[$alias->entryid] = array();
                }
                $aliases[$alias->entryid][] = $alias->alias;
            }
        }
        if (is_array($this->exportdata['categoryentries'])) {
            foreach ($this->exportdata['categoryentries'] as $cat) {
                if (!array_key_exists($cat->entryid, $categories)) {
                    $categories[$cat->entryid] = array();
                }
                $categories[$cat->entryid][] = $cat->name;
            }
        }
        if ($this->get('exporter')->get('formatclass') == PORTFOLIO_FORMAT_SPREADSHEET) {
            $csv = glossary_generate_export_csv($entries, $aliases, $categories);
            $this->exporter->write_new_file($csv, clean_filename($this->cm->name) . '.csv', false);
            return;
        } else if ($this->get('exporter')->get('formatclass') == PORTFOLIO_FORMAT_LEAP2A) {
            $ids = array(); // keep track of these to make into a selection later
            global $USER, $DB;
            $writer = $this->get('exporter')->get('format')->leap2a_writer($USER);
            $format = $this->exporter->get('format');
            $filename = $this->get('exporter')->get('format')->manifest_name();
            foreach ($entries as $e) {
                $content = glossary_entry_portfolio_caller::entry_content(
                    $this->course,
                    $this->cm,
                    $this->glossary,
                    $e,
                    (array_key_exists($e->id, $aliases) ? $aliases[$e->id] : array()),
                    $format
                );
                $entry = new portfolio_format_leap2a_entry('glossaryentry' . $e->id, $e->concept, 'entry', $content);
                $entry->author    = $DB->get_record('user', array('id' => $e->userid), 'id,firstname,lastname,email');
                $entry->published = $e->timecreated;
                $entry->updated   = $e->timemodified;
                if (!empty($this->keyedfiles[$e->id])) {
                    $writer->link_files($entry, $this->keyedfiles[$e->id], 'glossaryentry' . $e->id . 'file');
                    foreach ($this->keyedfiles[$e->id] as $file) {
                        $this->exporter->copy_existing_file($file);
                    }
                }
                if (!empty($categories[$e->id])) {
                    foreach ($categories[$e->id] as $cat) {
                        // this essentially treats them as plain tags
                        // leap has the idea of category schemes
                        // but I think this is overkill here
                        $entry->add_category($cat);
                    }
                }
                $writer->add_entry($entry);
                $ids[] = $entry->id;
            }
            $selection = new portfolio_format_leap2a_entry('wholeglossary' . $this->glossary->id, get_string('modulename', 'glossary'), 'selection');
            $writer->add_entry($selection);
            $writer->make_selection($selection, $ids, 'Grouping');
            $content = $writer->to_xml();
        }
        $this->exporter->write_new_file($content, $filename, true);
    }
655577
public function createPackage()
    {
        return array(
            't' => 'timing',
            'utc' => $this->getTimingCategory(),
            'utv' => $this->getTimingVariable(),
            'utt' => $this->getTimingTime(),
            'utl' => $this->getTimingLabel(),
            'dns' => $this->getBrowserDnsLoadTime(),
            'pdt' => $this->getBrowserPageDownloadTime(),
            'rrt' => $this->getBrowserRedirectTime(),
            'tcp' => $this->getBrowserTcpConnectTime(),
            'srt' => $this->getBrowserServerResponseTime()
        );
    }
619439
protected function prepareProcessContext()
    {
        $this->context = app($this->processContextClass, [ $this->data, $this->settings ]);

        $this->context->command = $this->command;
    }
1128359
public function onReady()
    {
        $this->setWatermark(2, $this->pool->maxAllowedPacket);
        Crypt::randomString(16, null, function ($string) {
            $this->key = base64_encode($string);
            $this->write('GET /' . $this->path . " HTTP/1.1\r\nHost: " . $this->host . ($this->port != 80 ? ':' . $this->port : '') . "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: " . $this->key . "\r\nSec-WebSocket-Version: 13\r\n\r\n");
        });
    }
609805
public function init()
    {

        // initialize the prepared statements
        $this->categoryDecimalsStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CATEGORY_DECIMALS));
        $this->categoryDecimalsByPkAndStoreIdStmt =
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CATEGORY_DECIMALS_BY_PK_AND_STORE_ID));
    }
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());
    }
915104
public function build()
    {
        # Fixed Header
        # Control Packet Type
        $cmd = $this->getMessageType() << 4;

        $cmd |= ($this->reserved_flags & 0x0F);

        $header = chr($cmd) . $this->remaining_length_bytes;

        $header .= $this->buildVariableHeader();

        return $header;
    }
205514
public function prepare()
    {

        $options = $this->options->prepareOptions;

        if( $options & Options::BACKUP or true ) {

            $root = $this->options->pathRoot;
            $pathsToBackup = $this->options->getPathsToBackup();

            // make a fully qualified path relative to $root
            $anchorToRoot = function( $path ) use ($root) {
                return escapeshellarg( "." . substr( $path, strlen($root) ) );
            };

            $pathsToBackup = array_map( $anchorToRoot, $pathsToBackup );
            $pathsToBackup = implode( ' ', $pathsToBackup );

            $backupDir = $this->options->getPath('backup');
            $filename = "{$backupDir}/" . self::fileSystemFriendly(
                date( DateTime::POSTGRES_TIMESTAMP_WITHOUT_TIME_ZONE_NO_MICROSECONDS )
            ) . '.tar.gz';

            $command = sprintf(
                'cd %s; tar cszf %s --exclude=%s -C %s %s; cd -',
                escapeshellarg( $root ),
                escapeshellarg( $filename ),
                $anchorToRoot( $backupDir ),
                escapeshellarg( $root ),
                $pathsToBackup
            );

            exec( $command );

        }

        // trash _all_ previously generated entitys
        /* BROKEN - Too agressive. Doesn't consider $options['match']
        $rebuild = in_array( $option, array( self::REBUILD_AND_BACKUP, self::REBUILD_NO_BACKUP ) );
        if( $rebuild ) {
            foreach( new \DirectoryIterator( $this->paths['entity'] ) as $item ) {
                if( $item->isFile() ) {
                    // unlink( $item->getPathname() );
                }
            }
        }
         */

    }
1285100
public function prepare()
    {
        if ($this->ready) {
            return null;
        }

        $this->ready = true;

        $format     = $this->format;
        $controller = $this->controller;

        foreach ($this->classMethods as $value) {
            if ($format === self::BOTH || $format === self::SLASH) {
                $route = '/' . (empty($value[1]) ? '' : ($value[1] . '/'));

                Route::set($value[0], $route, $controller . ':' . $value[2]);
            }

            if ($format === self::BOTH || $format === self::NOSLASH) {
                $route = empty($value[1]) ? '' : ('/' . $value[1]);

                Route::set($value[0], $route, $controller . ':' . $value[2]);
            }
        }

        $controller = $classMethods = null;
    }
131641
private function prepareUpload() {
		if(!current_user_can('upload_files')) {
			json_response(["status" => "error", "message" => "Current user can't upload."]);
		}

		if (!$this->client || !$this->client->enabled()) {
			json_response(["status" => "error", "message" => "Storage settings are invalid."]);
		}

		$filename = $_POST['filename'];
		$type = $_POST['type'];

		if (empty($filename) || empty($type)) {
			json_response(["status" => "error", "message" => "Invalid file name or missing type."]);
		}

		$prefix = StorageSettings::prefix(null);
		$parts = explode('/', $filename);
		$bucketFilename = array_pop($parts);

		$uploadInfo = $this->client->uploadUrl($prefix.$bucketFilename,StorageSettings::privacy(), $type,StorageSettings::cacheControl(), StorageSettings::expires());
		$res = $uploadInfo->toArray();
		$res['status'] = 'ready';
		json_response($res);
	}
1201759
private function prepare()
    {
        $constantParameters = $this->uriParser->predefinedParameters();
        array_map([$this, 'prepareConstant'], $constantParameters);

        $this->filter();
        $this->sort();

        return $this;
    }