for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sausin\Signere\Concerns;
trait UrlTransformer
{
/**
* Adjust the URL to production or test environment.
*
* @param string $url
* @param string $prefix
* @return string
*/
protected function transformUrl(string $url, string $prefix = 'test')
$check = $this->environment;
environment
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
if ($check === 'test' || $check === 'local' || $check === 'testing') {
return http_build_url($url, ['host' => $prefix.parse_url($url)['host']]);
}
return $url;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: