@param resource $resource Defaults to STDOUT

@return void
334744
private function help($resource = STDOUT)
    {
        $this->helper->writeLine(sprintf(
            self::HELP_TEMPLATE,
            $this->scriptName
        ), true, $resource);
    }
779852
private function serializeIterable($resource, OutputStream $out)
    {
        $memory = fopen('php://memory', 'wb');
        if (is_array($resource) && is_scalar(current($resource))) {
            if (!is_numeric(key($resource))) {
                $out->write($this->toCsvLine(array_keys($resource), $memory));
            }

            $out->write($this->toCsvLine($resource, $memory));
        } else {
            $head = true;
            foreach (Sequence::of($resource)->map('stubbles\sequence\castToArray') as $elements) {
                if ($head && !is_numeric(key($elements))) {
                    $out->write($this->toCsvLine(array_keys($elements), $memory));
                }

                $head = false;
                $out->write($this->toCsvLine($elements, $memory));
            }
        }

        fclose($memory);
    }
76991
public function release(IPoolResource $resource)
    {
        $hash = $resource->hashCode();
        if(isset($this->pool[$hash]))
        {
            $this->pool[$hash]->release();
            $resource->reset();
            $this->push($resource);
        }
    }
71956
public function handle($stdout, $stderr)
    {
        if (!is_null($stdout)) {
            $this->stdout .= $stdout;
        }

        if (!is_null($stderr)) {
            $this->stderr .= $stderr;
        }
    }
1009587
protected function setupCreateReference($resource)
    {
        foreach ($resource->settings['actions']['CreateReference']['uris'] as $property => $uri) {
            $this->setupCreate($resource, $uri, $property);
        }
    }
934257
public function registerResource(AbstractResourceFile $resource) {
        if (!isset($this->resources[md5($resource->getRealPath())])) {
            $this->resources[md5($resource->getRealPath())] = $resource;
        }
    }
450636
private function addHeaders($Resource, $headers) {
        $httpHeaders = array();
        foreach ($headers as $header => $value) {
            $httpHeaders[] = $header . ': ' . $value;
        }
        curl_setopt($Resource, CURLOPT_HTTPHEADER, $httpHeaders);
    }
1317111
private function assertValidResource($resource)
    {
        $resource = (string) $resource;
        // All resources are basic ASCII, so we can ignore the fact that `strtolower` doesn't handle UTF-8 well.
        $resource = strtolower($resource);

        if (!in_array($resource, static::VALID_RESOURCES)) {
            throw new InvalidResourceException($resource);
        }

        return $resource;
    }
414555
public function addResource(string ...$resource)
    {
        foreach ($resource as $_resource)
        {
            $this->resourceRegistry->save($_resource);
        }
    }
310766
static function configure($resource) {
		foreach( static::lookup_methods() as $type => $cb )
			$resource->addLookup($cb, $type);
		$refcnt =& self::$refcnt[static::class];
		if ( ! $refcnt++ ) static::on_setup();
	}
1304407
public function parse($resource, $output)
    {
        printf('file %s' . PHP_EOL, $resource);

        $pathinfo = pathinfo($resource);
        $extension = $pathinfo['extension'];

        $this->environment->setSourceFile($resource);

        $parser = $this->configuration->getParserForFileExtension($extension);

        if (!$parser instanceof ParserInterface) {
            throw new \Exception('No parser found. Have you initialized any plugins?');
        }

        if ($parser instanceof HasEnvironmentInterface) {
            $parser->setEnvironment($this->environment);
        }

        $content = $parser->parse($resource);
        $output  = $parser->getOutputFilename($output);
        file_put_contents($output, $content);
    }
309838
public function removeResource(ResourceNode $resource)
    {
        if ($this->isLinkedToResource($resource)) {
            $this->resources->removeElement($resource);
            --$this->resourceCount;
        }
    }
1109070
public function serialize($resource, OutputStream $out): OutputStream
    {
        if (is_scalar($resource) || $resource instanceof Error) {
            $out->writeLine((string) $resource);
        } elseif (is_array($resource) || $resource instanceof \Traversable) {
            $this->serializeIterable($resource, $out);
        } elseif (is_object($resource)) {
            $this->serializeIterable(castToArray($resource), $out);
        } else {
            trigger_error(
                    'Resource of type ' . typeOf($resource)
                    . ' can not be serialized to csv',
                    E_USER_ERROR
            );
        }

        return $out;
    }
811355
private function fixForActions(ActionedResourceInterface $resource): void
    {
        $actions = $resource->getActions();

        foreach ($actions as $action) {
            $routeHref = $action->getHref();
            $href = $this->fixHref($routeHref);
            $action->setHref($href);
        }
    }
230558
protected function setupDeleteReference($resource)
    {
        foreach ($resource->settings['actions']['DeleteReference']['uris'] as $property => $uri) {
            $this->setupDelete($resource, $uri, $property);
        }
    }
352441
protected function callController($resource)
    {
        $controllerName = $this->getControllerName($resource);

        if ($this->confirm("Do you want me to create a $controllerName controller? [yes|no]"))
        {
            $this->call('generate:controller', compact('controllerName'));
        }
    }
16269
protected function displayString(StringResource $resource, array $parameters)
    {
        extract($parameters, EXTR_SKIP);
        eval('; ?>' . $resource->getContents() . '<?php ;');
    }