public function handle($line, Client $client, Command $cmd) { $text = trim($line); if (preg_match(preg_quote($this->pattern), $line)) { $this->url = substr($text, strlen($this->pattern) - 2); $client->removeHandler(self::class); } }
public function handle($line, Client $client, Command $cmd) { if (preg_match(preg_quote($this->pattern), $line)) { $this->found = true; } if ($this->found) { if (preg_match(preg_quote($this->namePattern), $line)) { $name = explode(' - ', substr($line, 10)); if ($name[0]) { $this->theme['name'] = $name[0]; } if ($name[1]) { $this->theme['version'] = $name[1]; } $this->blockDetected = true; } elseif ($this->blockDetected == true) { if (preg_match(preg_quote($this->locationPattern), $line)) { $this->theme['location'] = substr($line, 14); return; } if (preg_match(preg_quote($this->stylePattern), $line)) { $this->theme['style'] = substr($line, 15); return; } if (preg_match(preg_quote($this->themeNamePattern), $line)) { $this->theme['theme_name'] = substr($line, 16); return; } if (preg_match(preg_quote($this->themeUriPattern), $line)) { $this->theme['theme_uri'] = substr($line, 15); return; } if (preg_match(preg_quote($this->authorPattern), $line)) { $this->theme['author'] = substr($line, 12); return; } if (preg_match(preg_quote($this->authorUriPattern), $line)) { $this->theme['author_uri'] = substr($line, 16); return; } if (preg_match(preg_quote($this->descriptionPattern), $line)) { $this->theme['description'] = substr($line, 17); return; } $client->removeHandler(self::class); } } }
public function handle($line, Client $client, Command $cmd) { if (preg_match(preg_quote($this->popularPluginsPattern), $line) || preg_match(preg_quote($this->allPluginsPattern), $line)) { $this->textBlock = true; } if (!$this->pluginFound) { if (preg_match(preg_quote($this->pluginsFoundpattern), $line)) { $this->pluginFound = true; if ($this->textBlock) { $lines = explode("\n", $line); foreach ($lines as $line) { $this->processLine($line); } } } } if (preg_match($this->endPattern, $line)) { $client->removeHandler(self::class); return; } if (!$this->textBlock) { $this->processLine($line); } }