{@inheritdoc}

@see \ImageStack\ImageBackend\PathRule\PathRuleInterface::createPath()
@return ImagePathInterface
429221
public function createPath(ImagePathInterface $path)
    {
        $matches = null;
        if (!preg_match($this->pattern, $path->getPath(), $matches)) {
            return null;
        }
        if (false === $this->output) {
            return null;
        }
        
        if (true === $this->output) {
            return $path;
        }
        
        if (is_callable($this->output)) {
            $newPath = call_user_func($this->output, $matches, $path);
            if ($newPath instanceof ImagePathInterface) {
                return $newPath;
            }
            return new ImagePath($newPath, $path->getPrefix());
        }
        
        if (is_string($this->output)) {
            $placeholders = [];
            foreach ($matches as $i => $v) {
                $placeholders[sprintf('${%d}', $i)] = $v;
            }
            return new ImagePath(strtr($this->output, $placeholders), $path->getPrefix());
        }
        
        $output = (array) $this->output;
        
        $newPath = '';
		foreach ($output as $item) {
			if (is_integer($item)) {
				$newPath .= $matches[$item];
			}
			else {
				$newPath .= (string)$item;
			}
		}
        
		return new ImagePath($newPath, $path->getPrefix());
    }
1570
public function addPath($path)
    {
        if (empty($path) || false === ($real_path = realpath($path))) {
            throw new FileNotFoundException(null, 0, null, $path);
        }
        $this->paths[] = $real_path;

        return $this;
    }
1115557
public static function createFromFilePath ($filePath)
    {
        if (!is_file($filePath))
        {
            throw new \InvalidArgumentException("File does not exist");
        }
        else if (!is_readable($filePath))
        {
            throw new \InvalidArgumentException("File to download is not readable.");
        }

        return new FileDownload(fopen($filePath, "rb"));
    }
18654
public static function create($filePath)
    {
        if (!file_exists($filePath)) {
            throw new Exception(["{$filePath} has not been found"]);
        }

        $file = fopen($filePath, 'r');

        $photo = json_decode(
            self::post(
                "photos",
                [
                    'multipart' => [['name' => 'photo', 'contents' => $file]],
                    'headers' => ['Content-Length' => filesize($filePath)]
                ]
            )->getBody(),
            true
        );

        return new self($photo);
    }
791284
private function createFromPng(string $path): self
    {
        $imageData = imagecreatefrompng($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create PNG image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->setTransparency(false, true);
        $this->encrypted = false;
        return $this;
    }
319746
public function create($path)
    {
        if ('' === $path) {
            $path = AbstractPath::SELF_ATOM;
        }

        $isAbsolute = false;
        $hasTrailingSeparator = false;

        $atoms = explode(AbstractPath::ATOM_SEPARATOR, $path);
        $numAtoms = count($atoms);

        if ($numAtoms > 1) {
            if ('' === $atoms[0]) {
                $isAbsolute = true;
                array_shift($atoms);
                --$numAtoms;
            }

            if ('' === $atoms[$numAtoms - 1]) {
                $hasTrailingSeparator = !$isAbsolute || $numAtoms > 1;
                array_pop($atoms);
            }
        }

        return $this->createFromAtoms(
            array_filter($atoms, 'strlen'),
            $isAbsolute,
            $hasTrailingSeparator
        );
    }
644839
protected function makePath($path)
    {
        return $this->context->directory ? $this->context->directory.'/'.$path : $path;
    }
239929
public function create($path)
    {
        $folders = explode('/', trim(preg_replace('#/+#', '/', $path), '/'));
        $lastFolderId = self::ROOT_DIR_ID;

        foreach ($folders as $name) {

            $command = new CreateFolder($name, $lastFolderId);
            $response = ResponseFactory::getResponse($this->contentClient, $command);

            if ($response instanceof SuccessResponse) {

                if ($response->getStatusCode() == 201) {
                    $lastFolderId = $response->json()['id'];
                    usleep(250);
                    continue;
                }

            } elseif ($response instanceof ErrorResponse) {

                if ($response->getStatusCode() == 409) {
                    $lastFolderId = reset($response->json()['context_info']['conflicts'])['id'];
                    usleep(250);
                    continue;
                }

                throw new \Exception($response->getStatusCode() . (string)$response->getBody());
            }
        }

        if (is_null($lastFolderId)) {
            throw new \Exception();
        }

        return $lastFolderId;
    }
1028726
public function create($path)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			// Turn passive mode on
			if (@ftp_pasv($this->conn, true) === false)
			{
				Log::add(__METHOD__ . ': Unable to use passive mode.', Log::WARNING, 'jerror');

				return false;
			}

			$buffer = fopen('buffer://tmp', 'r');

			if (@ftp_fput($this->conn, $path, $buffer, FTP_ASCII) === false)
			{
				Log::add(__METHOD__ . 'Bad response.', Log::WARNING, 'jerror');
				fclose($buffer);

				return false;
			}

			fclose($buffer);

			return true;
		}

		// Start passive mode
		if (!$this->_passive())
		{
			Log::add(__METHOD__ . ': Unable to use passive mode.', Log::WARNING, 'jerror');

			return false;
		}

		if (!$this->_putCmd('STOR ' . $path, array(150, 125)))
		{
			@ fclose($this->dataconn);
			Log::add(
				sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 150 or 125].  Path sent: %3$s', __METHOD__, $this->response, $path),
				Log::WARNING, 'jerror'
			);

			return false;
		}

		// To create a zero byte upload close the data port connection
		fclose($this->dataconn);

		if (!$this->_verifyResponse(226))
		{
			Log::add(
				sprintf('%1$s: Transfer failed.  Server response: %2$s [Expected: 226].  Path sent: %3$s', __METHOD__, $this->response, $path),
				Log::WARNING, 'jerror'
			);

			return false;
		}

		return true;
	}
436229
public function createPath()
    {
        if ($this->isReference()) {
            throw $this->noChildrenAllowed();
        }

        if ($this->path === null) {
            $this->path = new Path($this->getProject());
        }
        return $this->path->createPath();
    }
129878
public static function create($classPath) {

        if ( !isset(self::$INSTANES[$classPath]) ) {
            $reflect = new \ReflectionClass($classPath);
            $instance = $reflect->newInstance();
            $instance->initConfigs();
            self::$INSTANES[$classPath] = $instance;
        }
        return self::$INSTANES[$classPath];
    }
198983
public static function createFromPath(string $path, $context = null): self
    {
        $file_args = [$path, false];
        $mime_args = [$path, FILEINFO_MIME];
        if (null !== $context) {
            $file_args[] = $context;
            $mime_args[] = $context;
        }

        $content = @file_get_contents(...$file_args);
        if (false === $content) {
            throw new SyntaxError(sprintf('`%s` failed to open stream: No such file or directory', $path));
        }

        return new self(
            str_replace(' ', '', (new finfo(FILEINFO_MIME))->file(...$mime_args))
            .';base64,'.base64_encode($content)
        );
    }
133735
protected function createResource($data, $path)
    {
        //if the GD Library is not installed
        if (!function_exists('gd_info')) {
            //throw error
            throw ImageException::forGDNotInstalled();
        }

        # imagecreatefromgd — Create a new image from GD file or URL
        # imagecreatefromgif — Create a new image from file or URL
        # imagecreatefromjpeg — Create a new image from file or URL
        # imagecreatefrompng — Create a new image from file or URL
        # imagecreatefromstring — Create a new image from the image stream in the string
        # imagecreatefromwbmp — Create a new image from file or URL
        # imagecreatefromxbm — Create a new image from file or URL
        # imagecreatefromxpm — Create a new image from file or URL

        $resource = false;

        if (!$path) {
            return imagecreatefromstring($data);
        }

        //depending on the extension lets load
        //the file using the right GD loader
        switch ($this->type) {
            case 'gd':
                $resource = imagecreatefromgd($data);
                break;
            case 'gif':
                $resource = imagecreatefromgif($data);
                break;
            case 'jpg':
            case 'jpeg':
            case 'pjpeg':
                $resource = imagecreatefromjpeg($data);
                break;
            case 'png':
                $resource = imagecreatefrompng($data);
                break;
            case 'bmp':
            case 'wbmp':
                $resource = imagecreatefromwbmp($data);
                break;
            case 'xbm':
                $resource = imagecreatefromxbm($data);
                break;
            case 'xpm':
                $resource = imagecreatefromxpm($data);
                break;
        }

        //if there is no resource still
        if (!$resource) {
            //throw error
            ImageException::forInvalidImageFile($path);
        }

        return $resource;
    }
746319
public function withPath(Path $path): self
    {
        $url = Structure::fromString((string) $this)
            ->withPath(
                new UrlPath((string) $path)
            )
            ->withQuery(new NullQuery)
            ->withFragment(new NullFragment);

        return new self(
            (string) $url
        );
    }
323488
public function initFromPath($path)
    { 
        $this->setPosition(0);
        $this->setDataBuffer(null);

        $resource = $this->getService()->createResourceFromPath($path);
        if (!$resource) {
            return false;
        }

        $this->setResource($resource);
        return $this;
    }
1197782
public function create()
    {
        /**
         * @var ImageInterface $image
         */
        $classNamespace = $this->getEntityNamespace();
        $image = new $classNamespace();
        $image
            ->setEnabled(true)
            ->setCreatedAt($this->now());

        return $image;
    }
334347
private function createPathForUpload()
    {
        return sprintf(
            '%s://%s/%s.files',
            self::$streamWrapperProtocol,
            urlencode($this->databaseName),
            urlencode($this->bucketName)
        );
    }