get('path'); $dir = dirname($path); do { $nfo = "$dir/tvshow.nfo"; $dir = dirname($dir); } while (!file_exists($nfo) && $dir !== '/'); if (!file_exists($nfo)) { return $properties; } $properties['showNfo'] = $nfo; $xml = simplexml_load_file($nfo); $properties['showTmdb'] = $this->getProp($xml, 'tmdbid'); $properties['showImdb'] = $this->getProp($xml, 'imdb_id'); $properties['showTitle'] = $this->getProp($xml, 'title'); return $properties; } protected function getProp(SimpleXMLElement $xml, string $prop): ?string { return $xml->$prop ? (string) $xml->$prop : null; } }