1 | <?php |
||
10 | class ArticleData extends Data |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $stopWords = ['a', 'about', 'above', 'above', 'across', 'after', 'afterwards', 'again', 'against', |
||
16 | 'all', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', |
||
17 | 'amoungst', 'amount', 'an', 'and', 'another', 'any', 'anyhow', 'anyone', 'anything', 'anyway', 'anywhere', |
||
18 | 'are', 'around', 'as', 'at', 'back', 'be', 'became', 'because', 'become', 'becomes', 'becoming', 'been', |
||
19 | 'before', 'beforehand', 'behind', 'being', 'below', 'beside', 'besides', 'between', 'beyond', 'bill', 'both', |
||
20 | 'bottom', 'but', 'by', 'call', 'can', 'cannot', 'cant', 'co', 'con', 'could', 'couldnt', 'cry', 'de', |
||
21 | 'describe', 'detail', 'do', 'done', 'down', 'due', 'during', 'each', 'eg', 'eight', 'either', 'eleven', 'else', |
||
22 | 'elsewhere', 'empty', 'enough', 'etc', 'even', 'ever', 'every', 'everyone', 'everything', 'everywhere', |
||
23 | 'except', 'few', 'fifteen', 'fify', 'fill', 'find', 'fire', 'first', 'five', 'for', 'former', 'formerly', |
||
24 | 'forty', 'found', 'four', 'from', 'front', 'full', 'further', 'get', 'give', 'go', 'had', 'has', 'hasnt', |
||
25 | 'have', 'he', 'hence', 'her', 'here', 'hereafter', 'hereby', 'herein', 'hereupon', 'hers', 'herself', 'him', |
||
26 | 'himself', 'his', 'how', 'however', 'hundred', "i'd", 'ie', 'if', 'in', 'inc', 'indeed', 'interest', 'into', |
||
27 | 'is', 'it', 'its', 'itself', 'keep', 'last', 'latter', 'latterly', 'least', 'less', 'ltd', 'made', 'many', |
||
28 | 'may', 'me', 'meanwhile', 'might', 'mill', 'mine', 'more', 'moreover', 'most', 'mostly', 'move', 'much', 'must', |
||
29 | 'my', 'myself', 'name', 'namely', 'neither', 'never', 'nevertheless', 'next', 'nine', 'no', 'nobody', 'none', |
||
30 | 'noone', 'nor', 'not', 'nothing', 'now', 'nowhere', 'of', 'off', 'often', 'on', 'once', 'one', 'only', 'onto', |
||
31 | 'or', 'other', 'others', 'otherwise', 'our', 'ours', 'ourselves', 'out', 'over', 'own', 'part', 'per', |
||
32 | 'perhaps', 'please', 'put', 'rather', 're', 'same', 'see', 'seem', 'seemed', 'seeming', 'seems', 'serious', |
||
33 | 'several', 'she', 'should', 'show', 'side', 'since', 'sincere', 'six', 'sixty', 'so', 'some', 'somehow', |
||
34 | 'someone', 'something', 'sometime', 'sometimes', 'somewhere', 'still', 'such', 'system', 'take', 'ten', 'than', |
||
35 | 'that', 'the', 'their', 'them', 'themselves', 'then', 'thence', 'there', 'thereafter', 'thereby', 'therefore', |
||
36 | 'therein', 'thereupon', 'these', 'they', 'thickv', 'thin', 'third', 'this', 'those', 'though', 'three', |
||
37 | 'through', 'throughout', 'thru', 'thus', 'to', 'together', 'too', 'top', 'toward', 'towards', 'twelve', |
||
38 | 'twenty', 'two', 'un', 'under', 'until', 'up', 'upon', 'us', 'very', 'via', 'was', 'we', 'well', 'were', 'what', |
||
39 | 'whatever', 'when', 'whence', 'whenever', 'where', 'whereafter', 'whereas', 'whereby', 'wherein', 'whereupon', |
||
40 | 'wherever', 'whether', 'which', 'while', 'whither', 'who', 'whoever', 'whole', 'whom', 'whose', 'why', 'will', |
||
41 | 'with', 'within', 'without', 'would', 'yet', 'you', 'your', 'yours', 'yourself', 'yourselves', 'the', ]; |
||
42 | |||
43 | /** |
||
44 | * @param array $set |
||
|
|||
45 | */ |
||
46 | public function __construct() |
||
51 | |||
52 | /** |
||
53 | * @param string $identifier |
||
54 | * @param string $content |
||
55 | */ |
||
56 | public function push($identifier, $content) |
||
60 | |||
61 | /** |
||
62 | * @param string $for |
||
63 | * @param object $strategy |
||
64 | */ |
||
65 | public function findNearest($for, $strategy = null) |
||
73 | |||
74 | /** |
||
75 | * Return a list of recommendations. |
||
76 | * |
||
77 | * @param string $for - the item we want recommendations for |
||
78 | * @param object $strategy |
||
79 | * |
||
80 | * @return array - return a list of identifier ordered by closest |
||
81 | */ |
||
82 | public function recommend($for, $strategy = null) |
||
114 | |||
115 | /** |
||
116 | * Get an array of words from the content and a count of how many times |
||
117 | * they appear in the text. |
||
118 | * |
||
119 | * Note that this method is naive and can't tell the similarity between 'bird' and 'birds'. |
||
120 | * |
||
121 | * @param string $content |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | protected function getWordCount($content) |
||
135 | } |
||
136 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.