@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types = 1); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Copyright (c) 2015-2016 Andreas Heigl<[email protected]> |
@@ -83,16 +83,16 @@ |
||
83 | 83 | |
84 | 84 | $start = new \DateTime($input->getOption('start')); |
85 | 85 | |
86 | - if (! $start instanceof \DateTime) { |
|
86 | + if (!$start instanceof \DateTime) { |
|
87 | 87 | throw new \InvalidArgumentException('The given date could not be parsed'); |
88 | 88 | } |
89 | 89 | |
90 | - $config = parse_ini_file(__DIR__ . '/../../config/callingallpapers.ini'); |
|
90 | + $config = parse_ini_file(__DIR__.'/../../config/callingallpapers.ini'); |
|
91 | 91 | |
92 | 92 | $client = new Client([ |
93 | 93 | 'headers' => [ |
94 | 94 | 'Accept' => 'application/json', |
95 | - 'Authorization' => 'token ' . $config['github.token'], |
|
95 | + 'Authorization' => 'token '.$config['github.token'], |
|
96 | 96 | ], |
97 | 97 | ]); |
98 | 98 |
@@ -1,1 +1,1 @@ |
||
1 | -<?php declare(strict_types=1); /** * Copyright Andrea Heigl <[email protected]> * * Licenses under the MIT-license. For details see the included file LICENSE.md */ namespace Callingallpapers\Subcommands\Sessionize\Parser; use DOMDocument; use DOMXPath; use function preg_replace; use function strip_tags; use function strpos; use function var_dump; class Description { public function parse(DOMDocument $dom, DOMXPath $xpath) { $result = $xpath->query('//hr[contains(@class, "m-t-none")]'); if ($result->length < 1) { return ''; } $text = []; for ($i = 0; $i < $result->length; $i++) { $resultI = $result->item($i)->parentNode->childNodes; if ($resultI->length <= 0) { continue; } foreach ($resultI as $node) { $nodeText = trim($dom->saveXML($node)); if (0 !== strpos($nodeText,'<hr class="m-t-none">')) { continue; } $text[] = str_replace('<hr class="m-t-none">', '', $nodeText); } } $description = trim(implode('', $text)); $description = preg_replace(['/\<\!\-\-.*?\-\-\>/si', '/\<script.*?\<\/script\>/si'], '', $description); return $description; } } |
|
2 | 1 | \ No newline at end of file |
2 | +<?php declare(strict_types=1); /** * Copyright Andrea Heigl <[email protected]> * * Licenses under the MIT-license. For details see the included file LICENSE.md */ namespace Callingallpapers\Subcommands\Sessionize\Parser; use DOMDocument; use DOMXPath; use function preg_replace; use function strip_tags; use function strpos; use function var_dump; class Description { public function parse(DOMDocument $dom, DOMXPath $xpath) { $result = $xpath->query('//hr[contains(@class, "m-t-none")]'); if ($result->length < 1) { return ''; } $text = []; for ($i = 0; $i < $result->length; $i++) { $resultI = $result->item($i)->parentNode->childNodes; if ($resultI->length <= 0) { continue; } foreach ($resultI as $node) { $nodeText = trim($dom->saveXML($node)); if (0 !== strpos($nodeText, '<hr class="m-t-none">')) { continue; } $text[] = str_replace('<hr class="m-t-none">', '', $nodeText); } } $description = trim(implode('', $text)); $description = preg_replace(['/\<\!\-\-.*?\-\-\>/si', '/\<script.*?\<\/script\>/si'], '', $description); return $description; } } |
|
3 | 3 | \ No newline at end of file |