getWriter

@param bool $new

@return AbstractWriter
439913
public function getWriter($new = true)
    {
        if (!$this->writer || $new) {
            $class = sprintf('Windwalker\\Database\\Driver\\%s\\%sWriter', ucfirst($this->name), ucfirst($this->name));

            $this->writer = new $class($this);
        }

        return $this->writer;
    }
515507
function order($new = null)
    {
        if (isset($new) && ($this->_attributes['order'] != $new)){
            $this->change('order', (int)$new);
        }
        return $this->_attributes['order'];
    }
680712
protected function writer()
    {
        if (empty($this->writer)) {
            $this->writer = $this->factory()->writer();
        }

        return $this->writer;
    }
35488
public static function create($writerType)
    {
        $writer = null;

        switch ($writerType) {
            case Type::CSV:
                $writer = new CSV\Writer();
                break;
            case Type::XLSX:
                $writer = new XLSX\Writer();
                break;
            case Type::ODS:
                $writer = new ODS\Writer();
                break;
            default:
                throw new UnsupportedTypeException('No writers supporting the given type: ' . $writerType);
        }

        $writer->setGlobalFunctionsHelper(new GlobalFunctionsHelper());

        return $writer;
    }
327816
public static function create(bool $value = null, bool $allowSerializeEmpty = false): BoolNode
    {
        $node = new self();
        $node->value = $value;
        $node->allowSerializeEmpty = $allowSerializeEmpty;

        return $node;
    }
204904
public function writeable($create = true, $edit = true)
    {
        $this->actions[Action::CREATE] = $create;
        $this->actions[Action::EDIT] = $edit;

        return $this;
    }
303047
public function createWriter($filePath, $delimiter = WriterInterface::DELIMITER_DEFAULT, $fileCharset = WriterInterface::CHARSET_DEFAULT, $mode = 'w', $type = null)
    {
        if (null === $type) {
            $type = $this->getDefaultWriterType();
        }

        return $this->getWriterFactory()->createWriter($type, $filePath, $delimiter, $fileCharset, $mode);
    }
214295
public function create_config_instance($writer = false) {
        // We are always going to use the cache_config_disabled class for all regular request.
        // However if the code has requested the writer then likely something is changing and
        // we're going to need to interact with the config.php file.
        // In this case we will still use the cache_config_writer.
        $class = 'cache_config_disabled';
        if ($writer) {
            // If the writer was requested then something is changing.
            $class = 'cache_config_writer';
        }
        if (!array_key_exists($class, $this->configs)) {
            self::set_state(self::STATE_INITIALISING);
            if ($class === 'cache_config_disabled') {
                $configuration = $class::create_default_configuration();
            } else {
                $configuration = false;
                if (!cache_config::config_file_exists()) {
                    cache_config_writer::create_default_configuration(true);
                }
            }
            $this->configs[$class] = new $class;
            $this->configs[$class]->load($configuration);
        }
        self::set_state(self::STATE_READY);

        // Return the instance.
        return $this->configs[$class];
    }
162735
public function createAssetsSubfolder($write = false){
		$siteFolderName = singleton(URLSegmentFilter::class)->filter($this->Title);
		$folder = Folder::find_or_make($siteFolderName);

		if($write){
			$this->FolderID = $folder->ID;
			$this->write();
			if($this->isPublished()) $this->doPublish();
		}

		return $folder->ID;
	}
858956
public static function createWriter($type)
    {
        switch ($type) {
            case self::JSON:
                return new Impl\Json();
            case self::YAML:
                return new Impl\Yaml();
            case self::INI:
                return new Impl\Ini();
            case self::COLUMNS:
                return new Impl\Columns();
            case self::TABLE:
                return new Impl\ConsoleTable();
            case self::MARKDOWN:
                return new Impl\MarkdownTable();
            case self::DUMP:
                return new Impl\Dump();
        }

        throw new UnknownWriterTypeException("Sorry, writer type {$type} is not something I do");
    }
1373836
public function getTransaction($nested = true, $new = false)
    {
        if (!$this->transaction || $new) {
            $class = sprintf(
                'Windwalker\\Database\\Driver\\%s\\%sTransaction',
                ucfirst($this->name),
                ucfirst($this->name)
            );

            $this->transaction = new $class($this, $nested);
        }

        return $this->transaction;
    }
792159
private function getOutputWriter()
    {
        if ($this->useFile) {
            $of = $this->getOutfile();
            if (!$of) {
                $of = new PhingFile($this->formatter->getPreferredOutfile());
            }

            return new FileWriter($of, $this->append);
        } else {
            return $this->getDefaultOutput();
        }
    }
998154
public function getEngine($new = false)
    {
        if (!($this->engine instanceof \Twig_Environment) || $new) {
            $this->engine = new \Twig_Environment($this->getLoader(), $this->config->toArray());

            foreach (GlobalContainer::getExtensions() as $extension) {
                $this->engine->addExtension(clone $extension);
            }

            foreach ($this->extensions as $extension) {
                $this->engine->addExtension($extension);
            }

            foreach (GlobalContainer::getGlobals() as $name => $value) {
                $this->engine->addGlobal($name, $value);
            }

            if ($this->config->get('debug')) {
                $this->engine->addExtension($this->getDebugExtension());
            }
        }

        return $this->engine;
    }
94717
public function findModel($new = false)
    {
        $class = \Yii::$app->user->identityClass;
        return $new === true ? new $class() : Yii::$app->user->identity;
    }
760072
public function loadElement($type, $new = false)
	{
		if ($type == 'list')
		{
			$type = 'select';
		}

		$signature = md5($type);

		if ((isset($this->_elements[$signature]) && !($this->_elements[$signature] instanceof __PHP_Incomplete_Class)) && $new === false)
		{
			return $this->_elements[$signature];
		}

		$elementClass = __NAMESPACE__ . '\\Parameter\\Element\\' . ucfirst($type);

		if (!class_exists($elementClass))
		{
			if (isset($this->_elementPath))
			{
				$dirs = $this->_elementPath;
			}
			else
			{
				$dirs = array();
			}

			preg_match('/^[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/', str_replace('_', DS, $type) . '.php', $matches);
			$file = @ (string) $matches[0];

			if ($elementFile = \App::get('filesystem')->find($dirs, $file))
			{
				include_once $elementFile;
			}
			else
			{
				$false = false;
				return $false;
			}
		}

		if (!class_exists($elementClass))
		{
			$false = false;
			return $false;
		}

		$this->_elements[$signature] = new $elementClass($this);

		return $this->_elements[$signature];
	}
207097
public static function createWriter(PHPExcel $phpExcel, $writerType = '')
    {
        // Search type
        $searchType = 'IWriter';

        // Include class
        foreach (self::$searchLocations as $searchLocation) {
            if ($searchLocation['type'] == $searchType) {
                $className = str_replace('{0}', $writerType, $searchLocation['class']);

                $instance = new $className($phpExcel);
                if ($instance !== null) {
                    return $instance;
                }
            }
        }

        // Nothing found...
        throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
    }
418230
private function setWriter($writer = null)
    {
        if ($writer === null) {
            $writer = function ($string) {
                print $string;
            };
        }

        if (!is_callable($writer)) {
            throw new \InvalidArgumentException(
                'Writer must be callable'
            );
        }

        $this->writer = $writer;
    }