for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of persian validation package
*
* (c) Farhad Zand <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Iamfarhad\Validation;
use App;
class ValidationMessages
{
/**
* @var mixed lang
public $lang;
* ValidationMessages constructor.
public function __construct()
$app_lang = resource_path('lang/validation/'.App::getLocale().'.php');
resource_path
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$app_lang = /** @scrutinizer ignore-call */ resource_path('lang/validation/'.App::getLocale().'.php');
if (! file_exists($app_lang)) {
$this->lang = include $app_lang;
} else {
$this->lang = include __DIR__.'/lang/validation/'.App::getLocale().'.php';
}
* @param $message
* @param $attribute
* @param $rule
* @return string
public function message($message, $attribute, $rule): string
$attribute
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function message($message, /** @scrutinizer ignore-unused */ $attribute, $rule): string
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return str_replace($message, $this->lang[$rule], $message);