[Composer] Change gofabian/negotiation-middleware dependency requirement to support PHP 8.2 #96

Merged
tobias merged 4 commits from MrPetovan/friendica-directory:bug/php-8 into stable 2023-08-09 07:01:21 +02:00
4 changed files with 12 additions and 3 deletions
Showing only changes of commit 064fd922e7 - Show all commits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -14,12 +14,18 @@ class Photo
* @var \Atlas\Pdo\Connection * @var \Atlas\Pdo\Connection
*/ */
private $atlas; private $atlas;
/**
* @var string
*/
private $defaultProfilePictureSmallPath;
public function __construct( public function __construct(
\Atlas\Pdo\Connection $atlas \Atlas\Pdo\Connection $atlas,
string $defaultProfilePictureSmallPath
) )
{ {
$this->atlas = $atlas; $this->atlas = $atlas;
$this->defaultProfilePictureSmallPath = $defaultProfilePictureSmallPath;
} }
public function render(Request $request, Response $response, array $args): Response public function render(Request $request, Response $response, array $args): Response
@ -30,7 +36,7 @@ class Photo
); );
if (!$data) { if (!$data) {
$data = file_get_contents('public/images/default-profile-sm.jpg'); $data = file_get_contents($this->defaultProfilePictureSmallPath);
} }
//Try and cache our result. //Try and cache our result.

View file

@ -10,7 +10,8 @@ class Photo extends BaseRoute
public function __invoke(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response public function __invoke(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
{ {
return (new \Friendica\Directory\Controllers\Api\Photo( return (new \Friendica\Directory\Controllers\Api\Photo(
$this->container->atlas $this->container->atlas,
$this->container->get('defaultProfilePictureSmallPath')
))->render($request, $response, $args); ))->render($request, $response, $args);
} }
} }

View file

@ -99,6 +99,8 @@ $container['http'] = function (ContainerInterface $c): GuzzleHttp\ClientInterfac
return new GuzzleHttp\Client(['timeout' => 20, 'headers' => ['User-Agent' => 'FriendicaDirectory/' . trim($version) . ' ' . \GuzzleHttp\default_user_agent()]]); return new GuzzleHttp\Client(['timeout' => 20, 'headers' => ['User-Agent' => 'FriendicaDirectory/' . trim($version) . ' ' . \GuzzleHttp\default_user_agent()]]);
}; };
$container['defaultProfilePictureSmallPath'] = __DIR__ . '/../public/assets/images/default-profile-sm.jpg';
// Internal Dependency Injection // Internal Dependency Injection
$container[\Friendica\Directory\Models\Profile::class] = function (ContainerInterface $c): Friendica\Directory\Models\Profile { $container[\Friendica\Directory\Models\Profile::class] = function (ContainerInterface $c): Friendica\Directory\Models\Profile {