Use foreach for episode action strings, update variable names
This commit is contained in:
parent
cd17ad5079
commit
e6637a0201
@ -8,20 +8,21 @@ class EpisodeActionReader {
|
||||
const EPISODEACTION_IDENTIFIER = 'EpisodeAction{';
|
||||
|
||||
/**
|
||||
* @param string $episodeActionString
|
||||
* @param string $episodeActionsString
|
||||
* @return EpisodeAction[]
|
||||
*/
|
||||
public function fromString(string $episodeActionString): array {
|
||||
public function fromString(string $episodeActionsString): array {
|
||||
|
||||
$episodeActions = [];
|
||||
|
||||
$episodeActionStrings = explode(self::EPISODEACTION_IDENTIFIER, $episodeActionString);
|
||||
$episodeActionStrings = explode(self::EPISODEACTION_IDENTIFIER, $episodeActionsString);
|
||||
array_shift($episodeActionStrings);
|
||||
|
||||
for($i = 1; $i < count($episodeActionStrings); $i++) {
|
||||
foreach($episodeActionStrings as $episodeActionString) {
|
||||
|
||||
preg_match(
|
||||
'/EpisodeAction{(podcast=\')(?<podcast>.*?)(\', episode=\')(?<episode>.*?)(\', action=)(?<action>.*?)(, timestamp=)(?<timestamp>.*?)(, started=)(?<started>.*?)(, position=)(?<position>.*?)(, total=)(?<total>.*?)}]*/',
|
||||
self::EPISODEACTION_IDENTIFIER . $episodeActionStrings[$i],
|
||||
self::EPISODEACTION_IDENTIFIER . $episodeActionString,
|
||||
$matches
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user