Skip to content

Commit cc290a6

Browse files
author
An Phan
committed
More and more stuff
1 parent a0e36c7 commit cc290a6

File tree

70 files changed

+1019
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1019
-292
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
/node_modules
22
/public/storage
3+
/public/css
4+
/public/img
5+
/public/js
36
/storage/*.key
47
/vendor
58
/.idea
69
Homestead.json
710
Homestead.yaml
811
.env
12+
/config/customRules.php

app/Rules/AppIconsExist.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,50 @@
55
class AppIconsExist extends Rule
66
{
77
/**
8-
* @inheritdoc
8+
* {@inheritdoc}
99
* @throws \RuntimeException
1010
*/
1111
public function check()
1212
{
1313
// To keep things simple, we only check for the tags' existence,
1414
// not the icon files themselves.
1515
return
16-
count($this->crawler->filter('link[rel=apple-touch-icon]')) &&
16+
count($this->crawler->filter('link[rel=apple-touch-icon]')) ||
1717
count($this->crawler->filter('link[rel=icon]'));
1818
}
1919

2020
/**
21-
* @inheritdoc
21+
* {@inheritdoc}
2222
*/
2323
public function level()
2424
{
2525
return Levels::NOTICE;
2626
}
2727

2828
/**
29-
* @inheritdoc
29+
* {@inheritdoc}
3030
*/
3131
public function passedMessage()
3232
{
33-
return 'App icons for mobile devices found';
33+
return 'App icons for mobile devices found.';
3434
}
3535

3636
/**
37-
* @inheritdoc
37+
* {@inheritdoc}
3838
*/
3939
public function failedMessage()
4040
{
41-
return 'App icons for mobile devices not found';
41+
return 'App icons for mobile devices not found.';
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function helpMessage()
48+
{
49+
return <<<MSG
50+
App icons are used when your web page is saved to the home screen of a mobile device. They are specified by `<link rel="apple-touch-icon">` for iOS and `<link rel="icon">` for Android. Note that you can specify more than one icon to cater for different resolutions.
51+
You can read more about app icons for [iOS](https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html) and [Android](https://developer.chrome.com/multidevice/android/installtohomescreen), kupo!
52+
MSG;
4253
}
4354
}

app/Rules/CharacterSetExists.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CharacterSetExists extends Rule
77
private $charset;
88

99
/**
10-
* @inheritdoc
10+
* {@inheritdoc}
1111
*/
1212
public function check()
1313
{
@@ -26,23 +26,34 @@ public function check()
2626
}
2727

2828
/**
29-
* @inheritdoc
29+
* {@inheritdoc}
3030
*/
3131
public function passedMessage()
3232
{
33-
return "Character set found: `{$this->charset}`";
33+
return "Character set found: `{$this->charset}`.";
3434
}
3535

3636
/**
37-
* @inheritdoc
37+
* {@inheritdoc}
3838
*/
3939
public function failedMessage()
4040
{
41-
return 'Character set not found';
41+
return 'Character set not found.';
4242
}
4343

4444
public function getCharset()
4545
{
4646
return $this->charset;
4747
}
48+
49+
/**
50+
* {@inheritdoc}
51+
*/
52+
public function helpMessage()
53+
{
54+
return <<<MSG
55+
A valid [character set](https://en.wikipedia.org/wiki/Character_encodings_in_HTML) helps browsers display a page correctly.
56+
Most of the time you’ll want a `UTF-8` encoding. For HTML5, all you need is a `<meta charset="UTF-8">` tag in `<head>`, kupo!
57+
MSG;
58+
}
4859
}

app/Rules/DocTypeCorrect.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class DocTypeCorrect extends Rule
77
private $docType;
88

99
/**
10-
* @inheritdoc
10+
* {@inheritdoc}
1111
* @throws \Exception
1212
*/
1313
public function check()
@@ -20,19 +20,29 @@ public function check()
2020
}
2121

2222
/**
23-
* @inheritdoc
23+
* {@inheritdoc}
2424
*/
2525
public function passedMessage()
2626
{
27-
return "Doc type found: `{$this->docType}`";
27+
return "Doc type found: `{$this->docType}`.";
2828
}
2929

3030
/**
31-
* @inheritdoc
31+
* {@inheritdoc}
3232
*/
3333
public function failedMessage()
3434
{
35-
return 'Doc type not found';
35+
return 'Doc type not found.';
36+
}
37+
38+
/**
39+
* {@inheritdoc}
40+
*/
41+
public function helpMessage()
42+
{
43+
return <<<MSG
44+
A Doctype, or DOCTYPE, helps the HTML layout engines determine a layout mode, such as “[quirks mode](https://en.wikipedia.org/wiki/Quirks_mode)” or “standard mode.” For HTML5, a simple `<!DOCTYPE html>` declaration on top of your page should suffice, kupo!
45+
MSG;
3646
}
3747

3848
public function getDocType()

app/Rules/FacebookOGTagsExist.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class FacebookOGTagsExist extends Rule
66
{
77
/**
8-
* @inheritdoc
8+
* {@inheritdoc}
99
*/
1010
public function check()
1111
{
@@ -16,26 +16,36 @@ public function check()
1616
}
1717

1818
/**
19-
* @inheritdoc
19+
* {@inheritdoc}
2020
*/
2121
public function level()
2222
{
2323
return Levels::NOTICE;
2424
}
2525

2626
/**
27-
* @inheritdoc
27+
* {@inheritdoc}
2828
*/
2929
public function passedMessage()
3030
{
31-
return 'All basic Facebook Open Graph markups are implemented';
31+
return 'All basic Facebook Open Graph markups are implemented.';
3232
}
3333

3434
/**
35-
* @inheritdoc
35+
* {@inheritdoc}
3636
*/
3737
public function failedMessage()
3838
{
39-
return 'At least one of `og:url`, `og:title`, `og:description`, and `og:image` meta properties is missing';
39+
return 'At least one of `og:url`, `og:title`, `og:description`, and `og:image` meta properties is missing.';
40+
}
41+
42+
/**
43+
* {@inheritdoc}
44+
*/
45+
public function helpMessage()
46+
{
47+
return <<<MSG
48+
Though not mandatory, a page should have valid Open Graph (OG) markups to take control over how the content appears on Facebook. You can about them [here](https://developers.facebook.com/docs/sharing/webmasters), kupo!
49+
MSG;
4050
}
4151
}

app/Rules/FaviconExists.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FaviconExists extends Rule
1212
private $faviconUrl;
1313

1414
/**
15-
* @inheritdoc
15+
* {@inheritdoc}
1616
*/
1717
public function check()
1818
{
@@ -30,26 +30,36 @@ public function check()
3030
}
3131

3232
/**
33-
* @inheritdoc
33+
* {@inheritdoc}
3434
*/
3535
public function level()
3636
{
3737
return Levels::NOTICE;
3838
}
3939

4040
/**
41-
* @inheritdoc
41+
* {@inheritdoc}
4242
*/
4343
public function passedMessage()
4444
{
45-
return "Favicon found at `{$this->faviconUrl}`";
45+
return "Favicon found at `{$this->faviconUrl}`.";
4646
}
4747

4848
/**
49-
* @inheritdoc
49+
* {@inheritdoc}
5050
*/
5151
public function failedMessage()
5252
{
53-
return "Favicon not found at `{$this->faviconUrl}`";
53+
return "Favicon not found at `{$this->faviconUrl}`.";
54+
}
55+
56+
/**
57+
* {@inheritdoc}
58+
*/
59+
public function helpMessage()
60+
{
61+
return <<<MSG
62+
A [favicon](https://en.wikipedia.org/wiki/Favicon) (short for _favorite icon_) represents the site graphically on the tab bar or in bookmarks. If a favicon isn’t specified in the HTML markups, the browser will look for a file named `favicon.ico` at the root of the site, kupo!
63+
MSG;
5464
}
5565
}

app/Rules/GoogleAnalyticsInstalled.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class GoogleAnalyticsInstalled extends Rule
77
private $gaCode;
88

99
/**
10-
* @inheritdoc
10+
* {@inheritdoc}
1111
*/
1212
public function check()
1313
{
@@ -23,18 +23,33 @@ public function check()
2323
}
2424

2525
/**
26-
* @inheritdoc
26+
* {@inheritdoc}
2727
*/
2828
public function passedMessage()
2929
{
30-
return "Google Analytics code found (account # `{$this->gaCode}`)";
30+
return "Google Analytics code found (account # `{$this->gaCode}`).";
3131
}
3232

3333
/**
34-
* @inheritdoc
34+
* {@inheritdoc}
3535
*/
3636
public function failedMessage()
3737
{
38-
return 'Google Analytics code not found';
38+
return 'Google Analytics code not found.';
39+
}
40+
41+
/**
42+
* {@inheritdoc}
43+
*/
44+
public function helpMessage()
45+
{
46+
return <<<MSG
47+
As [Google Analytics](https://analytics.google.com) is arguably the most popular web analytics service, it’s assumed here that you want to integrate your site with a GA account. Of course you can safely ignore this rule if it isn’t the case, kupo!
48+
MSG;
49+
}
50+
51+
public function getGaCode()
52+
{
53+
return $this->gaCode;
3954
}
4055
}

app/Rules/GzipEnabled.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class GzipEnabled extends Rule
88
{
99
/**
10-
* @inheritdoc
10+
* {@inheritdoc}
1111
*/
1212
public function check()
1313
{
@@ -16,18 +16,28 @@ public function check()
1616
}
1717

1818
/**
19-
* @inheritdoc
19+
* {@inheritdoc}
2020
*/
2121
public function passedMessage()
2222
{
23-
return 'Content is gzipped';
23+
return 'Content is gzipped.';
2424
}
2525

2626
/**
27-
* @inheritdoc
27+
* {@inheritdoc}
2828
*/
2929
public function failedMessage()
3030
{
31-
return 'Content is not gzipped';
31+
return 'Content is not gzipped.';
32+
}
33+
34+
/**
35+
* {@inheritdoc}
36+
*/
37+
public function helpMessage()
38+
{
39+
return <<<MSG
40+
Compressing your web page helps reduce loading time and save bandwidth. If your server is Apache, this can be done with [some simple `.htaccess` rules](https://github.com/phanan/htaccess#compress-text-files), kupo!
41+
MSG;
3242
}
3343
}

0 commit comments

Comments
 (0)