for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Cp\Transformer;
/**
* Class UrlTransformer
*/
class UrlTransformer
{
* @var string
private $baseUrl;
* UrlTransformer constructor.
*
* @param string $baseUrl
public function __construct($baseUrl)
$this->baseUrl = $baseUrl;
}
* @param string $week
* @param string $seance
* @param string $type
* @return string
public function transformPlan($week, $seance, $type)
return sprintf(
'%s/plan-entrainement/%s/%s-seances-%s-semaines.html',
$this->baseUrl,
$type,
$seance,
$week
);
* @param string $typeName
public function transformType($typeName)
return sprintf('%s/plan-entrainement/%s.html', $this->baseUrl, $typeName);
* @param string $url
* @return array
null|array<string,string>
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function reverseConfiguration($url)
$thirdPart = substr($url, strrpos($url, '/') + 1);
preg_match_all('/^([\d]{1,2})-[\w]+-([\d]{1,2})/', $thirdPart, $matches);
$seance = isset($matches[1][0]) ? $matches[1][0] : null;
$week = isset($matches[2][0]) ? $matches[2][0] : null;
if (null === $seance || null === $week) {
return null;
return [
'seance' => $seance,
'week' => $week,
];
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.