slicesofcake /
file
| 1 | <?php |
||||
| 2 | namespace File\View\Helper; |
||||
| 3 | |||||
| 4 | use Cake\View\Helper; |
||||
| 5 | |||||
| 6 | class FileHelper extends Helper |
||||
| 7 | { |
||||
| 8 | |||||
| 9 | /** |
||||
| 10 | * {@inheritDoc} |
||||
| 11 | */ |
||||
| 12 | public $helpers = [ |
||||
| 13 | 'Html', |
||||
| 14 | ]; |
||||
| 15 | |||||
| 16 | /** |
||||
| 17 | * Thumb image. |
||||
| 18 | * |
||||
| 19 | * @param string|array $path Path to the image file, relative to the app/webroot/img/ direct. |
||||
| 20 | * @param array $options Array of HTML attributes. See above for special options. |
||||
| 21 | * @param string $thumb Name of thumb. |
||||
| 22 | * @return string completed img tag. |
||||
| 23 | * @see https://book.cakephp.org/3.0/en/views/helpers/html.html#linking-to-images |
||||
| 24 | */ |
||||
| 25 | public function thumb($path, array $options = [], string $thumb = 'default'): string |
||||
| 26 | { |
||||
| 27 | if ($thumb !== 'default') { |
||||
| 28 | $path = preg_replace('/default/', $thumb, $path); |
||||
| 29 | } |
||||
| 30 | |||||
| 31 | if (!is_array($options)) { |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 32 | $options = []; |
||||
| 33 | } |
||||
| 34 | |||||
| 35 | return $this->Html->image($path, $options); |
||||
|
0 ignored issues
–
show
Are you sure the usage of
$this->Html->image($path, $options) targeting Cake\View\Helper::__call() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
The method
image() does not exist on null.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
The property
Html does not exist on File\View\Helper\FileHelper. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 36 | } |
||||
| 37 | } |
||||
| 38 |