for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Satis\Model;
use App\Satis\ConfigManager;
use JMS\Serializer\Annotation\Type;
/**
* Repository class
*
* Represent a composer repository definition
* @author Lukas Homza <[email protected]>
*/
class Repository {
const REGEX = '#((git|ssh|http(s)?)|(git@[\w.]+))(:(\/\/)?)([\w.@:\/\-~]+)(\/)?#';
* @Type("string")
private $type;
private $url;
* Initialize with default opinionated values
public function __construct() {
$this->type = config('satis.default_repository_type');
$this->url = '';
}
* Get the string representation
* @return string
public function __toString() {
return $this->url;
* Get type
* @return string $type
public function getType() {
return $this->type;
* Set type
* @param string $type
* @return static
public function setType($type) {
$this->type = strtolower($type);
return $this;
* Get url
* @return string $url
public function getUrl() {
* Set url
* @param string $url
public function setUrl($url) {
$this->url = urldecode($url);
* Get repository ID
public function getId() {
return ConfigManager::nameToId($this->url);