Fixed some style errors; Updated the PHP_CodeSniffer rules to be better
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c4afe6f08e
commit
2b1ec13f53
34
phpcs.xml
34
phpcs.xml
@ -2,26 +2,32 @@
|
||||
|
||||
<ruleset name="PHP_CodeSniffer">
|
||||
|
||||
<description>PHPCS configuration file.</description>
|
||||
<description>PHPCS configuration file.</description>
|
||||
|
||||
<arg name="basepath" value="." />
|
||||
<arg name="extensions" value="php" />
|
||||
<arg name="colors" />
|
||||
<arg name="cache" value=".phpcs-cache" />
|
||||
<arg value="p" />
|
||||
<arg value="s" />
|
||||
<arg name="basepath" value="." />
|
||||
<arg name="extensions" value="php" />
|
||||
<arg name="colors" />
|
||||
<arg name="cache" value=".phpcs-cache" />
|
||||
<arg value="p" />
|
||||
<arg value="s" />
|
||||
|
||||
<!-- Check PHP files in the src/ directory -->
|
||||
<file>src/</file>
|
||||
<!-- Check PHP files in the src/ directory -->
|
||||
<file>src/</file>
|
||||
|
||||
<!-- Our base rule: set to PSR12-->
|
||||
<rule ref="PSR12"/>
|
||||
<!-- Our base rule: set to PSR12-->
|
||||
<rule ref="PSR12">
|
||||
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
|
||||
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
|
||||
</rule>
|
||||
|
||||
<!-- Set indent size to 2 -->
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<!-- Some custom rules -->
|
||||
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
|
||||
<rule ref="Generic.Classes.OpeningBraceSameLine" />
|
||||
<!-- Set indent size to 2 -->
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="indent" value="2" />
|
||||
</properties>
|
||||
</rule>
|
||||
</rule>
|
||||
|
||||
</ruleset>
|
||||
|
@ -15,7 +15,7 @@ use Pigeon\Models\Video;
|
||||
$config = new Config('config/config.yaml');
|
||||
|
||||
// create Eloquent connection object
|
||||
$capsule = new Capsule;
|
||||
$capsule = new Capsule();
|
||||
$capsule->addConnection([
|
||||
'driver' => 'sqlite',
|
||||
'database' => $config->get('pigeon.db_path'),
|
||||
@ -36,12 +36,12 @@ $uploads = $youtube->getPlaylistItemsByPlaylistId($config->get('youtube.uploads_
|
||||
|
||||
// create Video model objects with the above uploads
|
||||
foreach ($uploads as $u) {
|
||||
$video = new Video;
|
||||
$video = new Video();
|
||||
$video->video_id = $u->contentDetails->videoId;
|
||||
$video->published_at = date($u->contentDetails->videoPublishedAt);
|
||||
|
||||
// create the table entry if it doesn't already exist
|
||||
Video::where('video_id', $video->video_id)->firstOr(function() use ($video) {
|
||||
Video::where('video_id', $video->video_id)->firstOr(function () use ($video) {
|
||||
$video->save();
|
||||
});
|
||||
}
|
||||
@ -63,7 +63,7 @@ $loop->addPeriodicTimer($config->get('pigeon.check_interval') * 60, function ()
|
||||
$uploadDetails = $uploads[0]->contentDetails;
|
||||
|
||||
// search for the latest video in the DB
|
||||
Video::where('video_id', $uploadDetails->videoId)->firstOr(function() use ($discord, $config, $uploadDetails) {
|
||||
Video::where('video_id', $uploadDetails->videoId)->firstOr(function () use ($discord, $config, $uploadDetails) {
|
||||
$latest_url = "https://youtu.be/$uploadDetails->videoId";
|
||||
|
||||
$message_text = str_replace('{link}', $latest_url, $config->get('discord.message_template'));
|
||||
@ -75,7 +75,7 @@ $loop->addPeriodicTimer($config->get('pigeon.check_interval') * 60, function ()
|
||||
});
|
||||
|
||||
// add the video to the DB
|
||||
$video = new Video;
|
||||
$video = new Video();
|
||||
$video->video_id = $uploadDetails->videoId;
|
||||
$video->published_at = date($uploadDetails->videoPublishedAt);
|
||||
$video->save();
|
||||
|
Loading…
Reference in New Issue
Block a user