null, 'width' => null, 'height' => null, 'method' => null, 'extension' => null]; $pathInfo = $request->getPathInfo(); $prefixLen = strlen('thumbnails/'); if ('thumbnails/' === substr($pathInfo, 0, $prefixLen) && false !== ($loDashIdx = strrpos($pathInfo, '_')) && preg_match(self::PATTERN, substr($pathInfo, $loDashIdx + 1), $match) ) { $params['image'] = substr($pathInfo, $prefixLen, $loDashIdx - $prefixLen); $params['width'] = $match[1]; $params['height'] = $match[2]; $params['method'] = $match[3]; $params['extension'] = $match[4]; if ($params['image'] && is_numeric($params['width']) && is_numeric($params['height'])) { return [$this->route, $params]; } } return false; } }