Create a write context.

@return \Protobuf\WriteContext
322378
public function createWriteContext()
    {
        $stream      = Stream::create();
        $writer      = $this->getStreamWriter();
        $sizeContext = $this->createComputeSizeContext();
        $context     = new WriteContext($stream, $writer, $sizeContext);

        return $context;
    }
1259720
public function createCommentStory(AnCommandContext $context)
    {
        //called by the comment controller as as callback
        $entity = $context->comment;
        $parent = $context->comment->parent;

        $owner = $entity->author;

        if ($parent->isOwnable()) {
            $owner = $parent->owner;
        }

        $data = array(
            'name' => $parent->getIdentifier()->name.'_comment',
            'component' => $parent->component,
            'comment' => $entity,
            'object' => $parent,
            'owner' => $owner,
            'target' => $parent->isOwnable()  ? $parent->owner : null,
        );

        $story = $this->_mixer->createStory($data);

        if ($this->isNotifier()) {
            //story owner
            $data['subscribers'] = array($story->owner);

            //all the not subscribers
            if ($parent->isSubscribable()) {
                $data['subscribers'][] = $parent->subscriberIds->toArray();
            }

            $notification = $this->_mixer->createNotification($data);

            $notification->setType('post');
        }

        $story->save();
    }
65327
private function createDocBlockContext()
    {
        $file = $this->descriptor->getFile();
        $namespaceAliases = $file ? $file->getNamespaceAliases()->getAll() : array();

        return new Context($this->descriptor->getNamespace(), $namespaceAliases);
    }
799411
private function write()
	{
		$content = '';

		foreach ($this->getFiles() as $file)
		{
			$content .= '$this->call(\'' . str_replace('.php', '', $file) . '\');';	
		}
		
		$databaseSeeder = str_replace('{calls}', $content, $this->getPattern());

		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.php', $databaseSeeder);
	}
1250055
public function addContext(Context $context) {
    $contexts = $this->get('contextOut');
    $contexts[] = $context;
    $this->add('contextOut', $contexts);
  }
886412
private function createDocBlockContext(): Context
    {
        $file = $this->descriptor->getFile();
        $namespaceAliases = $file ? $file->getNamespaceAliases()->getAll() : [];
        foreach ($namespaceAliases as $alias => $fqsen) {
            $namespaceAliases[$alias] = (string) $fqsen;
        }

        return new Context((string) $this->descriptor->getNamespace(), $namespaceAliases);
    }
923358
protected function _initWriter()
    {
        $this->_writer = new Mage_Archive_Helper_File($this->_destinationFilePath);
        $this->_writer->open('w');

        return $this;
    }
815806
function _createContext(context) {
  let newContext = context || _defaultContext
  if (_isString(newContext) || _isArray(newContext)) {
    newContext = {
      any: _arrayify(newContext),
    }
  } else {
    newContext = _arrayizeContext(context)
  }
  return newContext
}
972586
public function write()
    {
        foreach ($this->parameters as $prop => $value) {
            $placeHolders[] = sprintf('<%s>', $prop);
            $replacements[] = $value;
        }

        $config = str_replace($placeHolders, $replacements, self::$configTemplate);
        $config = sprintf('%s%s%s', self::$defaultConfigTemplate, PHP_EOL, $config);

        if (true === $this->parameters['composer']) {
            $config = sprintf('%s%s%s', $config, PHP_EOL, self::$downloadComposerTaskTemplate);
        }

        if (true === $this->parameters['schemadb']) {
            $config = sprintf('%s%s%s', $config, PHP_EOL, self::$updateSchemaTaskTemplate);
        }

        fwrite($this->file, $this->addHeaders($config));
    }
18392
public function write()
	{
		$lines		= array();
		$sections	= $this->getSections();
		foreach( $sections as $section )
		{
			$lines[]	= "[".$section."]";
			foreach( $this->data[$section] as $key => $value )
				$lines[]	= $this->fillUp( $key )."=".$value;
		}
		return FS_File_Writer::saveArray( $this->fileName, $lines );
		$this->read();
	}
758229
public function getContext() {
        return new ExecutionStepContextContext(
            $this->version,
            $this->solution['flowSid'],
            $this->solution['executionSid'],
            $this->solution['stepSid']
        );
    }
924643
public function write()
	{
		// do we need to rotate?
		if ($this->rotationInterval and $this->rotationTimer < time())
		{
			$this->rotate();
		}

		return $this->driver->write();
	}
502412
public function batchWrite(Context\BatchWrite $context)
    {
        if (null !== $this->logger) {
            $this->log('BatchWrite');
        }

        if (0 === count($context)) {
            $message = "BatchWrite context doesn't contain anything to write";
            if (null !== $this->logger) {
                $this->log($message, Logger::ERROR);
            }
            throw new Exception\AttributesException($message);
        }

        $parameters = $context->getForDynamoDB();

        if (null !== $this->logger) {
            $this->log('BatchWrite request paramaters : '.print_r($parameters, true), Logger::DEBUG);
        }

        $response = $this->connector->batchWriteItem($parameters);

        if (null !== $this->logger) {
            $this->log('BatchWrite request response : '.print_r($response, true), Logger::DEBUG);
        }

        // UnprocessedKeys
        if (count((array)$response['UnprocessedItems'])) {
            $newContext = new Context\BatchWrite();
            foreach ($response['UnprocessedItems'] as $table => $tableParameters) {
                foreach ($tableParameters as $request) {
                    if (isset($request['DeleteRequest'])) {
                        $keys = $request['DeleteRequest']['Key'];
                        $newContext->addKeyToDelete(
                            $table,
                            current($keys['HashKeyElement']),
                            (isset($keys['RangeKeyElement'])?current($keys['RangeKeyElement']):null)
                        );
                    } elseif (isset($request['PutRequest'])) {
                        $item = new Item($table);
                        $item->populateFromDynamoDB($request['PutRequest']['Item']);
                        $newContext->addItemToPut($item);
                    }
                }
            }

            if (null !== $this->logger) {
                $this->log('More unprocessed Items');
            }
        } else {
            $newContext = null;
        }

        // Write Unit
        foreach ($response['Responses'] as $table => $responseItems) {
            $this->addConsumedWriteUnits($table, floatval($responseItems['ConsumedCapacityUnits']));
        }

        return $newContext;
    }
302617
public static function setup_real_writer_instance() {
        if (!PHPUNIT_TEST) {
            throw new coding_exception('setup_real_writer_instance() is only for use with PHPUnit tests.');
        }

        $instance = static::instance();

        if (null === $instance->realwriter) {
            $instance->realwriter = new moodle_content_writer(static::instance());
        }
    }
883887
public function context()
    {
        $this->logger->debug('kernel.context: generate Context instance');

        $request = Request::globals();
        $response = new Response;
        return new Context($request, $response);
    }
571485
public function getContext()
    {
        $context = new KViewContextTemplate();
        $context->setSubject($this);
        $context->setData($this->_data);
        $context->setLayout($this->getLayout());

        return $context;
    }
442666
public function createContext()
    {
        $resolvedOptions = $this->optionsResolver->resolve($this->options);

        // wrap content
        if ($resolvedOptions['content'] instanceof ContentInterface) {
            $resolvedOptions['content'] = $this->contentResolver->resolve(
                $resolvedOptions['content']
            );
        }

        // create variation
        $variation = $this->variationResolver->resolve((new VariationContext())
            ->denormalize($resolvedOptions)
        );

        return new RenderingContext(
            $resolvedOptions['component'],
            $resolvedOptions['content'],
            $variation,
            $this->contextNormalizer->normalize(
                $resolvedOptions['content'],
                $resolvedOptions['theme'],
                $resolvedOptions['template'],
                $resolvedOptions['zone'],
                $resolvedOptions['component']
            )
        );
    }