Creates a symbolic link.

@param string $link
@param string $target
@return bool
16029
public static function create(string $link = '', string $target = ''): bool
    {
        $ret = true;
        $link = static::normalizePath($link);
        $target = static::normalizePath($target);

        if (static::verifyPath($link) && static::verifyPath($target) && Directory::create(\dirname($link)) &&
            !\file_exists($link) && \file_exists($target)) {

            $ret = @\symlink($target, $link);
            @\chmod($link, static::$newSymlinkMode);
        }

        return $ret;
    }
1153059
public function linkTo($destination) {
		$target = new FileDescriptor($destination);
		$targetDir = new Directory($target->getDirname());
		$targetDir->make();

		$ok = false;
		if ($target->isLink()) {
			if (!$target->getLinkTarget()->equals($this->pathname)) {
				$target->delete();
			} else {
				$ok = true;
			}
		}

		if (!$ok && @symlink($this->pathname, $target->getPathname()) !== true) {
			$report = error_get_last();
			if (is_array($report) && DIRECTORY_SEPARATOR === '\\' && strpos($report['message'], 'error code(1314)') !== false) {
				throw new FileException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?');
			}
			throw new FileException(sprintf('Failed to create symbolic link from %s to %s', $this->pathname, $targetDir));
		}
	}
659095
public static function linkify($tweet, $target = '_blank')
    {
        if ($target == null) {
            $target = '_blank';
        }

        $tweet = preg_replace_callback(
            "#(^|[\n ])@([a-z0-9_-]*)#is",
            function ($matches) use ($target) {
                return sprintf('%s<a href="https://twitter.com/%s" target="%s" class="user"><span>@</span>%s</a>',
                    $matches[1], $matches[2], $target, $matches[2]);
            }, $tweet
        );

        $tweet = preg_replace_callback(
            "#(^|[\n ])\#([a-z0-9_-]*)#is",
            function ($matches) use ($target) {
                return sprintf('%s<a href="https://twitter.com/search?q=%%23%s" target="%s" class="hashtag"><span>#</span>%s</a>',
                    $matches[1], $matches[2], $target, $matches[2]);
            }, $tweet
        );

        $tweet = preg_replace_callback(
            "#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t<]*)#is",
            function ($matches) use ($target) {
                return sprintf('%s<a href="%s" target="%s" class="link">%s</a>',
                    $matches[1], $matches[2], $target, $matches[2]);
            }, $tweet
        );

        $tweet = preg_replace_callback(
            "#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is",
            function ($matches) use ($target) {
                return sprintf('%s<a href="http://%s" target="%s" class="link">%s</a>',
                    $matches[1], $matches[2], $target, $matches[2]);
            }, $tweet
        );

        return $tweet;
    }
142154
function link($target, $link)
    {
        $this->files->ensureDirExists(
            $linkPath = $this->sitesPath(), user()
        );

        $this->config->prependPath($linkPath);

        $this->files->symlinkAsUser($target, $linkPath.'/'.$link);

        return $linkPath.'/'.$link;
    }
721830
public function homeLink($link)
    {
        if (!(strpos($link, "http://") === 0 or
            strpos($link, "https://") === 0 or
            strpos($link, "ftp://") === 0 or
            strpos($link, "www.") === 0)
        ) {
            $home = $this->container->get("router")->generate('claro_index').$link;

            $home = str_replace("//", "/", $home);

            return $home;
        }

        return $link;
    }
658396
public function hasLink($link) {
        $found = false;
        array_walk_recursive($this->navigation, function($value, $key) use (&$found, $link) {
            if ($value == $link && $key === 'uri') {
                $found = true;
            }
        });
        return $found;
    }
850361
private function symlink(string $originDir, string $targetDir, bool $relative = false)
    {
        if ($relative) {
            $this->filesystem->mkdir(\dirname($targetDir));
            $originDir = $this->filesystem->makePathRelative($originDir, realpath(\dirname($targetDir)));
        }
        $this->filesystem->symlink($originDir, $targetDir);
        if (!file_exists($targetDir)) {
            throw new IOException(sprintf('Symbolic link "%s" was created but appears to be broken.', $targetDir), 0, null, $targetDir);
        }
    }
697078
protected function _createsymlinks($check = false) {
		$this->out(__d('cake_installer', 'Creating symbolic links to files'));
		$this->hr();

		$resultCheck = $this->InstallerCheck->checkSymLinksExists();
		if ($resultCheck) {
			if ($check) {
				$this->out('<success>' . __d('cake_installer', 'This action has already been successfully completed. Skipped.') . '</success>');

				return true;
			} elseif ($this->useActionNotify) {
				if (!$this->_checkSure(__d('cake_installer', 'All symbolic links to files exists. Rewrite?'))) {
					return true;
				}
			}
		}

		$symlinksList = $this->ConfigInstaller->getListSymlinksCreation();
		if (empty($symlinksList)) {
			$this->out('<info>' . __d('cake_installer', 'List of symbolic links is empty') . '</info>');

			return true;
		}

		$this->waiting->animateMessage();
		$truncateOpt = [
			'ellipsis' => '...',
			'exact' => true,
			'html' => false
		];
		$result = true;
		$messages = [];
		foreach ($symlinksList as $link => $target) {
			if (empty($link)) {
				continue;
			}

			$badTarget = ((empty($target) || !file_exists($target)) ? true : false);
			$linkExists = false;
			if (file_exists($link)) {
				if (is_link($link) && (stripos(readlink($link), $target) === 0)) {
					$linkExists = true;
				} else {
					if (is_dir($link)) {
						//@codingStandardsIgnoreStart
						@rmdir($link);
						//@codingStandardsIgnoreEnd
					} else {
						unlink($link);
					}
				}
			}

			//@codingStandardsIgnoreStart
			if ($linkExists || (!$badTarget && @symlink($target, $link))) {
				//@codingStandardsIgnoreEnd
				$state = '<success>' . __d('cake_installer', 'Ok') . '</success>';
			} else {
				$state = '<error>' . __d('cake_installer', 'Bad') . '</error>';
				$result = false;
			}

			$state = '[' . $state . ']';
			$message = ' * ' . CakeText::truncate($link, $this->maxWidth - 12, $truncateOpt);
			$messages[] = $this->state->getState($message, $state, $this->maxWidth - 1);
			$this->waiting->animateMessage();
		}
		if (empty($messages)) {
			$messages[] = '<info>' . __d('cake_installer', 'List of symbolic links is empty') . '</info>';
		}

		$this->waiting->hideMessage();
		$this->out($messages, 1);
		$this->hr();
		if ($result) {
			$this->out('<success>' . __d('cake_installer', 'Creating symbolic links completed successfully.') . '</success>');
		} else {
			$this->out('<error>' . __d('cake_installer', 'Creating symbolic links unsuccessfully.') . '</error>');
		}

		return $result;
	}
333147
def _make_symlink(self, link_name: str, link_target: str):
        ''''''
        path = self._file_writer_session.extra_resource_path('dummy')

        if path:
            dir_path = os.path.dirname(path)
            symlink_path = os.path.join(dir_path, link_name)

            _logger.debug('symlink {} -> {}', symlink_path, link_target)

            os.symlink(link_target, symlink_path)

            _logger.info(
                _('Created symbolic link {symlink_path} to target {symlink_target}.'),
                symlink_path=symlink_path,
                symlink_target=link_target
            )
752944
public function putSymlink($bucket, $symlink ,$targetObject, $options = NULL)
    {
        $this->precheckCommon($bucket, $symlink, $options);

        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
        $options[self::OSS_OBJECT] = $symlink;
        $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK;
        $options[self::OSS_HEADERS][self::OSS_SYMLINK_TARGET] = rawurlencode($targetObject);

        $response = $this->auth($options);
        $result = new PutSetDeleteResult($response);
        return $result->getData();
    }
660188
public function linkBuilder($link)
    {
        if (is_array($link)) {
            list($route, $params) = $link;

            return $this->generateLink($route, $params);
        } else {
            return $this->generateLink($link, null);
        }
    }
1293620
public function assertDontSeeLink($link)
    {
        if ($this->resolver->prefix) {
            $message = "Saw unexpected link [{$link}] within [{$this->resolver->prefix}].";
        } else {
            $message = "Saw unexpected link [{$link}].";
        }

        PHPUnit::assertFalse(
            $this->seeLink($link),
            $message
        );

        return $this;
    }
462164
protected function symlink($target, $link)
    {
        $fs = FileSystem::getFileSystem();

        if ($this->isRelative()) {
            $link = (new PhingFile($link))->getAbsolutePath();
            $target = rtrim($this->makePathRelative($target, dirname($link)), '/');
        }

        if (is_link($link) && @readlink($link) == $target) {
            $this->log('Link exists: ' . $link, Project::MSG_INFO);

            return true;
        }

        if (file_exists($link) || is_link($link)) {
            if (!$this->getOverwrite()) {
                $this->log('Not overwriting existing link ' . $link, Project::MSG_ERR);

                return false;
            }

            if (is_link($link) || is_file($link)) {
                $fs->unlink($link);
                $this->log('Link removed: ' . $link, Project::MSG_INFO);
            } else {
                $fs->rmdir($link, true);
                $this->log('Directory removed: ' . $link, Project::MSG_INFO);
            }
        }

        $this->log('Linking: ' . $target . ' to ' . $link, Project::MSG_INFO);

        return $fs->symlink($target, $link);
    }
128514
public function asLink($href=NULL,$target=NULL) {
		parent::asLink($href,$target);
		return $this;
	}
984641
def symlink_to(self, target, target_is_directory=False):
        
        if self._closed:
            self._raise_closed()
        self._accessor.symlink(target, self, target_is_directory)
481047
protected function getInvalidLinkError($scheme, $target, $anchorName = null)
    {
        $url = "$scheme://$target" . ($anchorName ? '#' . $anchorName : '');

        switch ($scheme) {
            case 'eznode':
                return sprintf('Invalid link "%s": target node cannot be found', $url);
            case 'ezobject':
                return sprintf('Invalid link "%s": target object cannot be found', $url);
            default:
                throw new InvalidArgumentException($scheme, "Given scheme '{$scheme}' is not supported.");
        }
    }
1124219
public function createLink($from, $to)
    {
        if (File::exists($from)) {
            if (!File::exists($to)) {
                try {
                    symlink($from, $to);
                } catch (\Exception $e) {
                    throw new \Exception("Cannot create symlink from $from to $to");
                }
            }
        }
    }