/** * Disable the styleci webhook for the given repo. * * @param \StyleCI\StyleCI\Models\Repo $repo * * @return void */ public function disable(Repo $repo) { $url = route('home'); $args = explode('/', $repo->name); $client = $this->factory->make($repo); $hooks = $client->repo()->hooks(); $paginator = new ResultPager($client); foreach ($paginator->fetchAll($hooks, 'all', $args) as $hook) { if ($hook['name'] !== 'web' || StaticStringy::contains($hook['config']['url'], $url, false) !== true) { continue; } $hooks->remove($args[0], $args[1], $hook['id']); } }
/** * 一つのお題を表す配列から問題行に直列化します。 * @param (string|string[]|float)[][] $word * @param string $directoryName * @return string 末尾に改行 (CRLF) を含みます。 */ protected function serializeQuestionLine(array $word, string $directoryName) : string { $line = ['Q']; if (isset($word['image'][0])) { $line[] = 2; $fileLocation = $word['image'][0]; } elseif (isset($word['audio'][0])) { $line[] = 1; $fileLocation = $word['audio'][0]; } else { $line[] = 0; } $line[] = isset($word['question'][0]) ? $this->serializeQuizField($word['question'][0]) : ''; if (isset($fileLocation)) { $line[] = (\Stringy\StaticStringy::contains($fileLocation, '/') ? '' : "./{$directoryName}/") . $fileLocation; } if (isset($word['specifics'][0])) { $specifics = new URLSearchParams($word['specifics'][0]); if ($specifics->has('start')) { $line[] = 'start=' . round($specifics->get('start') * InteligenceoParser::SECONDS_TO_MILISECONDS); } if ($specifics->has('repeat')) { $line[] = 'repeat=' . $specifics->get('repeat'); } if ($specifics->has('length')) { $line[] = 'length=' . round($specifics->get('length') * InteligenceoParser::SECONDS_TO_MILISECONDS); } if ($specifics->has('speed')) { $line[] = 'speed=' . round($specifics->get('speed') * InteligenceoParser::DECIMAL_TO_PERCENT); } if ($specifics->has('magnification')) { $magnification = round($specifics->get('magnification')); if ($magnification > 0) { $line[] = "zoom_start={$magnification}"; if ($specifics->has('last-magnification')) { $lastMagnification = round($specifics->get('last-magnification')); if ($lastMagnification > 0) { $line[] = "zoom_end={$lastMagnification}"; } } } } if ($specifics->has('pixelization')) { $line[] = 'mozaic=1'; } if ($specifics->has('score')) { $line[] = 'score=' . $specifics->get('score'); if ($specifics->has('last-score')) { $line[] = 'finalscore=' . $specifics->get('last-score'); } } } return implode(',', $line) . "\r\n"; }
/** * @dataProvider containsProvider() */ public function testContains($expected, $haystack, $needle, $caseSensitive = true, $encoding = null) { $result = S::contains($haystack, $needle, $caseSensitive, $encoding); $this->assertInternalType('boolean', $result); $this->assertEquals($expected, $result); }
public function index($value, $params = array()) { return Stringy::contains($value, array_get($params, 0), array_get($params, 1, false)); }
public function contains($string, $subString) { return Stringy::contains($string, $subString); }