mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-13 06:29:30 +00:00
Used PHP_CS_Fixer with symfony preset on codebase.
This commit is contained in:
parent
0f3ba9b6a8
commit
e2f7aafa2d
43 changed files with 971 additions and 1068 deletions
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* part-db version 0.1
|
||||
* Copyright (C) 2005 Christoph Lechner
|
||||
* http://www.cl-projects.de/
|
||||
* http://www.cl-projects.de/.
|
||||
*
|
||||
* part-db version 0.2+
|
||||
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||
|
|
@ -26,34 +25,32 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
*/
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
|
||||
use Symfony\Component\Asset\Packages;
|
||||
|
||||
class AttachmentFilenameService
|
||||
{
|
||||
protected $package;
|
||||
protected $package;
|
||||
|
||||
public function __construct(Packages $package)
|
||||
{
|
||||
$this->package = $package;
|
||||
}
|
||||
|
||||
public function attachmentPathToAbsolutePath(?string $filename) : ?string
|
||||
public function attachmentPathToAbsolutePath(?string $filename): ?string
|
||||
{
|
||||
//Return placeholder if a part does not have an attachment
|
||||
if ($filename == null) {
|
||||
if (null == $filename) {
|
||||
return $this->package->getUrl('/img/part_placeholder.svg');
|
||||
}
|
||||
if (stripos($filename, "%BASE%/img/") !== false) {
|
||||
if (false !== stripos($filename, '%BASE%/img/')) {
|
||||
return $this->package->getUrl(str_replace('%BASE%', '', $filename));
|
||||
}
|
||||
|
||||
//If no other method works, return placeholder
|
||||
return $this->package->getUrl('/img/part_placeholder.svg');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue