@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param string $endpoint API endpoint. |
| 38 | 38 | * @param array $body Request body. |
| 39 | 39 | * |
| 40 | - * @return stdClass|WP_Error |
|
| 40 | + * @return stdClass |
|
| 41 | 41 | */ |
| 42 | 42 | protected function call( $method, $endpoint, $body = array() ) { |
| 43 | 43 | if ( is_wp_error( $error = $this->can_call() ) ) { |
@@ -31,6 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Delete the file. |
| 33 | 33 | * |
| 34 | + * @param string $message |
|
| 34 | 35 | * @return array |
| 35 | 36 | */ |
| 36 | 37 | public function delete_file( $path, $sha, $message ) { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @param int $post_id Post ID. |
| 169 | 169 | * |
| 170 | - * @return boolean |
|
| 170 | + * @return null|boolean |
|
| 171 | 171 | */ |
| 172 | 172 | public function export_post( $post_id ) { |
| 173 | 173 | if ( wp_is_post_revision( $post_id ) ) { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @param int $post_id Post ID. |
| 201 | 201 | * |
| 202 | - * @return boolean |
|
| 202 | + * @return null|boolean |
|
| 203 | 203 | */ |
| 204 | 204 | public function delete_post( $post_id ) { |
| 205 | 205 | if ( wp_is_post_revision( $post_id ) ) { |
@@ -108,7 +108,6 @@ discard block |
||
| 108 | 108 | * and associates their author as well as their latest |
| 109 | 109 | * |
| 110 | 110 | * @param Writing_On_GitHub_Post[] $posts Array of Posts to save. |
| 111 | - * @param string $email Author email. |
|
| 112 | 111 | * |
| 113 | 112 | * @return string|WP_Error |
| 114 | 113 | */ |
@@ -178,6 +177,9 @@ discard block |
||
| 178 | 177 | return __( 'Successfully saved posts.', 'writing-on-github' ); |
| 179 | 178 | } |
| 180 | 179 | |
| 180 | + /** |
|
| 181 | + * @param Writing_On_GitHub_Post $post |
|
| 182 | + */ |
|
| 181 | 183 | protected function post_args( $post ) { |
| 182 | 184 | $args = $post->get_args(); |
| 183 | 185 | $meta = $post->get_meta(); |
@@ -142,6 +142,10 @@ |
||
| 142 | 142 | return true; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | + /** |
|
| 146 | + * @param Writing_On_GitHub_Post $post |
|
| 147 | + * @param Writing_On_GitHub_Persist_Client $persist |
|
| 148 | + */ |
|
| 145 | 149 | protected function new_post( $post, $persist ) { |
| 146 | 150 | $github_path = $post->github_path(); |
| 147 | 151 | $old_github_path = $post->old_github_path(); |
@@ -140,6 +140,9 @@ discard block |
||
| 140 | 140 | return __( 'Payload processed', 'writing-on-github' ); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | + /** |
|
| 144 | + * @param boolean $delete_ids |
|
| 145 | + */ |
|
| 143 | 146 | protected function compare( $files, &$delete_ids ) { |
| 144 | 147 | if ( is_wp_error( $files ) ) { |
| 145 | 148 | return $files; |
@@ -217,7 +220,6 @@ discard block |
||
| 217 | 220 | /** |
| 218 | 221 | * Checks whether the provided blob should be imported. |
| 219 | 222 | * |
| 220 | - * @param Writing_On_GitHub_Blob $blob Blob to validate. |
|
| 221 | 223 | * |
| 222 | 224 | * @return bool |
| 223 | 225 | */ |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | /** |
| 42 | 42 | * Validates the header's secret. |
| 43 | 43 | * |
| 44 | - * @return true|WP_Error |
|
| 44 | + * @return boolean |
|
| 45 | 45 | */ |
| 46 | 46 | public function is_secret_valid() { |
| 47 | 47 | $headers = $this->headers(); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | * Creates a literal block for dumping |
| 362 | 362 | * @access private |
| 363 | 363 | * @return string |
| 364 | - * @param $value |
|
| 364 | + * @param string $value |
|
| 365 | 365 | * @param $indent int The value of the indent |
| 366 | 366 | */ |
| 367 | 367 | private function _doLiteralBlock($value,$indent) { |
@@ -430,6 +430,9 @@ discard block |
||
| 430 | 430 | return in_array($value, $words, true); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | + /** |
|
| 434 | + * @param string $value |
|
| 435 | + */ |
|
| 433 | 436 | private function isTranslationWord($value) { |
| 434 | 437 | return ( |
| 435 | 438 | self::isTrueWord($value) || |
@@ -471,11 +474,17 @@ discard block |
||
| 471 | 474 | |
| 472 | 475 | // LOADING FUNCTIONS |
| 473 | 476 | |
| 477 | + /** |
|
| 478 | + * @param string $input |
|
| 479 | + */ |
|
| 474 | 480 | private function __load($input) { |
| 475 | 481 | $Source = $this->loadFromSource($input); |
| 476 | 482 | return $this->loadWithSource($Source); |
| 477 | 483 | } |
| 478 | 484 | |
| 485 | + /** |
|
| 486 | + * @param string $input |
|
| 487 | + */ |
|
| 479 | 488 | private function __loadString($input) { |
| 480 | 489 | $Source = $this->loadFromString($input); |
| 481 | 490 | return $this->loadWithSource($Source); |
@@ -692,6 +701,7 @@ discard block |
||
| 692 | 701 | /** |
| 693 | 702 | * Used in inlines to check for more inlines or quoted strings |
| 694 | 703 | * @access private |
| 704 | + * @param string $inline |
|
| 695 | 705 | * @return array |
| 696 | 706 | */ |
| 697 | 707 | private function _inlineEscape($inline) { |
@@ -822,12 +832,18 @@ discard block |
||
| 822 | 832 | return $explode; |
| 823 | 833 | } |
| 824 | 834 | |
| 835 | + /** |
|
| 836 | + * @param integer $lineIndent |
|
| 837 | + */ |
|
| 825 | 838 | private function literalBlockContinues ($line, $lineIndent) { |
| 826 | 839 | if (!trim($line)) return true; |
| 827 | 840 | if (strlen($line) - strlen(ltrim($line)) > $lineIndent) return true; |
| 828 | 841 | return false; |
| 829 | 842 | } |
| 830 | 843 | |
| 844 | + /** |
|
| 845 | + * @param boolean $alias |
|
| 846 | + */ |
|
| 831 | 847 | private function referenceContentsByAlias ($alias) { |
| 832 | 848 | do { |
| 833 | 849 | if (!isset($this->SavedGroups[$alias])) { echo "Bad group name: $alias."; break; } |
@@ -926,6 +942,9 @@ discard block |
||
| 926 | 942 | |
| 927 | 943 | } |
| 928 | 944 | |
| 945 | + /** |
|
| 946 | + * @param string $line |
|
| 947 | + */ |
|
| 929 | 948 | private static function startsLiteralBlock ($line) { |
| 930 | 949 | $lastChar = substr (trim($line), -1); |
| 931 | 950 | if ($lastChar != '>' && $lastChar != '|') return false; |
@@ -935,6 +954,9 @@ discard block |
||
| 935 | 954 | return $lastChar; |
| 936 | 955 | } |
| 937 | 956 | |
| 957 | + /** |
|
| 958 | + * @param string $line |
|
| 959 | + */ |
|
| 938 | 960 | private static function greedilyNeedNextLine($line) { |
| 939 | 961 | $line = trim ($line); |
| 940 | 962 | if (!strlen($line)) return false; |
@@ -944,6 +966,10 @@ discard block |
||
| 944 | 966 | return false; |
| 945 | 967 | } |
| 946 | 968 | |
| 969 | + /** |
|
| 970 | + * @param string $literalBlock |
|
| 971 | + * @param string $literalBlockStyle |
|
| 972 | + */ |
|
| 947 | 973 | private function addLiteralLine ($literalBlock, $line, $literalBlockStyle, $indent = -1) { |
| 948 | 974 | $line = self::stripIndent($line, $indent); |
| 949 | 975 | if ($literalBlockStyle !== '|') { |
@@ -963,6 +989,9 @@ discard block |
||
| 963 | 989 | return $literalBlock . $line; |
| 964 | 990 | } |
| 965 | 991 | |
| 992 | + /** |
|
| 993 | + * @param string $literalBlock |
|
| 994 | + */ |
|
| 966 | 995 | function revertLiteralPlaceHolder ($lineArray, $literalBlock) { |
| 967 | 996 | foreach ($lineArray as $k => $_) { |
| 968 | 997 | if (is_array($_)) |
@@ -978,6 +1007,9 @@ discard block |
||
| 978 | 1007 | return substr ($line, $indent); |
| 979 | 1008 | } |
| 980 | 1009 | |
| 1010 | + /** |
|
| 1011 | + * @param integer $indent |
|
| 1012 | + */ |
|
| 981 | 1013 | private function getParentPathByIndent ($indent) { |
| 982 | 1014 | if ($indent == 0) return array(); |
| 983 | 1015 | $linePath = $this->path; |
@@ -1003,6 +1035,9 @@ discard block |
||
| 1003 | 1035 | } |
| 1004 | 1036 | |
| 1005 | 1037 | |
| 1038 | + /** |
|
| 1039 | + * @param string $line |
|
| 1040 | + */ |
|
| 1006 | 1041 | private static function isComment ($line) { |
| 1007 | 1042 | if (!$line) return false; |
| 1008 | 1043 | if ($line[0] == '#') return true; |
@@ -1010,6 +1045,9 @@ discard block |
||
| 1010 | 1045 | return false; |
| 1011 | 1046 | } |
| 1012 | 1047 | |
| 1048 | + /** |
|
| 1049 | + * @param string $line |
|
| 1050 | + */ |
|
| 1013 | 1051 | private static function isEmpty ($line) { |
| 1014 | 1052 | return (trim ($line) === ''); |
| 1015 | 1053 | } |
@@ -1035,6 +1073,9 @@ discard block |
||
| 1035 | 1073 | } |
| 1036 | 1074 | |
| 1037 | 1075 | |
| 1076 | + /** |
|
| 1077 | + * @param string $value |
|
| 1078 | + */ |
|
| 1038 | 1079 | private static function unquote ($value) { |
| 1039 | 1080 | if (!$value) return $value; |
| 1040 | 1081 | if (!is_string($value)) return $value; |
@@ -1043,10 +1084,16 @@ discard block |
||
| 1043 | 1084 | return $value; |
| 1044 | 1085 | } |
| 1045 | 1086 | |
| 1087 | + /** |
|
| 1088 | + * @param string $line |
|
| 1089 | + */ |
|
| 1046 | 1090 | private function startsMappedSequence ($line) { |
| 1047 | 1091 | return (substr($line, 0, 2) == '- ' && substr ($line, -1, 1) == ':'); |
| 1048 | 1092 | } |
| 1049 | 1093 | |
| 1094 | + /** |
|
| 1095 | + * @param string $line |
|
| 1096 | + */ |
|
| 1050 | 1097 | private function returnMappedSequence ($line) { |
| 1051 | 1098 | $array = array(); |
| 1052 | 1099 | $key = self::unquote(trim(substr($line,1,-1))); |
@@ -1063,6 +1110,9 @@ discard block |
||
| 1063 | 1110 | } |
| 1064 | 1111 | } |
| 1065 | 1112 | |
| 1113 | + /** |
|
| 1114 | + * @param string $line |
|
| 1115 | + */ |
|
| 1066 | 1116 | private function returnMappedValue ($line) { |
| 1067 | 1117 | $this->checkKeysInValue($line); |
| 1068 | 1118 | $array = array(); |
@@ -1071,18 +1121,30 @@ discard block |
||
| 1071 | 1121 | return $array; |
| 1072 | 1122 | } |
| 1073 | 1123 | |
| 1124 | + /** |
|
| 1125 | + * @param string $line |
|
| 1126 | + */ |
|
| 1074 | 1127 | private function startsMappedValue ($line) { |
| 1075 | 1128 | return (substr ($line, -1, 1) == ':'); |
| 1076 | 1129 | } |
| 1077 | 1130 | |
| 1131 | + /** |
|
| 1132 | + * @param string $line |
|
| 1133 | + */ |
|
| 1078 | 1134 | private function isPlainArray ($line) { |
| 1079 | 1135 | return ($line[0] == '[' && substr ($line, -1, 1) == ']'); |
| 1080 | 1136 | } |
| 1081 | 1137 | |
| 1138 | + /** |
|
| 1139 | + * @param string $line |
|
| 1140 | + */ |
|
| 1082 | 1141 | private function returnPlainArray ($line) { |
| 1083 | 1142 | return $this->_toType($line); |
| 1084 | 1143 | } |
| 1085 | 1144 | |
| 1145 | + /** |
|
| 1146 | + * @param string $line |
|
| 1147 | + */ |
|
| 1086 | 1148 | private function returnKeyValuePair ($line) { |
| 1087 | 1149 | $array = array(); |
| 1088 | 1150 | $key = ''; |
@@ -1111,6 +1173,9 @@ discard block |
||
| 1111 | 1173 | } |
| 1112 | 1174 | |
| 1113 | 1175 | |
| 1176 | + /** |
|
| 1177 | + * @param string $line |
|
| 1178 | + */ |
|
| 1114 | 1179 | private function returnArrayElement ($line) { |
| 1115 | 1180 | if (strlen($line) <= 1) return array(array()); // Weird %) |
| 1116 | 1181 | $array = array(); |
@@ -1124,6 +1189,9 @@ discard block |
||
| 1124 | 1189 | } |
| 1125 | 1190 | |
| 1126 | 1191 | |
| 1192 | + /** |
|
| 1193 | + * @param string $line |
|
| 1194 | + */ |
|
| 1127 | 1195 | private function nodeContainsGroup ($line) { |
| 1128 | 1196 | $symbolsForReference = 'A-z0-9_\-'; |
| 1129 | 1197 | if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-) |
@@ -1136,12 +1204,20 @@ discard block |
||
| 1136 | 1204 | |
| 1137 | 1205 | } |
| 1138 | 1206 | |
| 1207 | + /** |
|
| 1208 | + * @param string $line |
|
| 1209 | + * @param string $group |
|
| 1210 | + */ |
|
| 1139 | 1211 | private function addGroup ($line, $group) { |
| 1140 | 1212 | if ($group[0] == '&') $this->_containsGroupAnchor = substr ($group, 1); |
| 1141 | 1213 | if ($group[0] == '*') $this->_containsGroupAlias = substr ($group, 1); |
| 1142 | 1214 | //print_r ($this->path); |
| 1143 | 1215 | } |
| 1144 | 1216 | |
| 1217 | + /** |
|
| 1218 | + * @param string $line |
|
| 1219 | + * @param string $group |
|
| 1220 | + */ |
|
| 1145 | 1221 | private function stripGroup ($line, $group) { |
| 1146 | 1222 | $line = trim(str_replace($group, '', $line)); |
| 1147 | 1223 | return $line; |
@@ -159,6 +159,9 @@ |
||
| 159 | 159 | // } |
| 160 | 160 | // } |
| 161 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $repo |
|
| 164 | + */ |
|
| 162 | 165 | protected function malformed_repo( $repo ) { |
| 163 | 166 | update_option( Base::REPO_OPTION_KEY, $repo ); |
| 164 | 167 | |