diff --git a/core/lib/Drupal/Component/Utility/Random.php b/core/lib/Drupal/Component/Utility/Random.php index 10d3bc7..1a938b6 100644 --- a/core/lib/Drupal/Component/Utility/Random.php +++ b/core/lib/Drupal/Component/Utility/Random.php @@ -162,13 +162,13 @@ public function object($size = 4) { * The minimum number of words in the return string. Total word count * can slightly exceed provided this value in order to deliver * sentences of random length. - * @param bool $title + * @param bool $capitalize * Uppercase all the words in the string. * * @return string * Nonsense latin words which form sentence(s). */ - public function createSentences($min_word_count, $title = FALSE) { + public function createSentences($min_word_count, $capitalize = FALSE) { $dictionary = array("abbas", "abdo", "abico", "abigo", "abluo", "accumsan", "acsi", "ad", "adipiscing", "aliquam", "aliquip", "amet", "antehabeo", "appellatio", "aptent", "at", "augue", "autem", "bene", "blandit", @@ -202,7 +202,7 @@ public function createSentences($min_word_count, $title = FALSE) { $dictionary_flipped = array_flip($dictionary); $greeking = ''; - if (!$title) { + if (!$capitalize) { $words_remaining = $min_word_count; while ($words_remaining > 0) { $sentence_length = mt_rand(3, 10); @@ -225,12 +225,12 @@ public function createSentences($min_word_count, $title = FALSE) { * Generate a string that looks like a word. * * @param int $length - * The desired word length. + * The desired word length. * * @return string */ public function generateWord($length) { - mt_srand((double)microtime()*1000000); + mt_srand((double) microtime()*1000000); $vowels = array("a", "e", "i", "o", "u"); $cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", @@ -248,7 +248,7 @@ public function generateWord($length) { } /** - * Generate greekings separated by double new line. + * Generate paragraphs separated by double new line. * * @param int $paragraph_count * @return string @@ -256,7 +256,7 @@ public function generateWord($length) { public function generateParagraphs($paragraph_count = 12) { $output = ''; for ($i = 1; $i <= $paragraph_count; $i++) { - $output .= $this->createSentences(mt_rand(20,60)) ."\n\n"; + $output .= $this->createSentences(mt_rand(20, 60)) ."\n\n"; } return $output; } @@ -278,23 +278,23 @@ public function generateImage($destination, $min_resolution, $max_resolution) { $min = explode('x', $min_resolution); $max = explode('x', $max_resolution); - $width = rand((int)$min[0], (int)$max[0]); - $height = rand((int)$min[1], (int)$max[1]); + $width = rand((int) $min[0], (int) $max[0]); + $height = rand((int) $min[1], (int) $max[1]); // Make an image split into 4 sections with random colors. $im = imagecreate($width, $height); for ($n = 0; $n < 4; $n++) { $color = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255)); - $x = $width/2 * ($n % 2); - $y = $height/2 * (int) ($n >= 2); - imagefilledrectangle($im, $x, $y, $x + $width/2, $y + $height/2, $color); + $x = $width / 2 * ($n % 2); + $y = $height / 2 * (int) ($n >= 2); + imagefilledrectangle($im, $x, $y, $x + $width / 2, $y + $height / 2, $color); } // Make a perfect circle in the image middle. $color = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255)); $smaller_dimension = min($width, $height); $smaller_dimension = ($smaller_dimension % 2) ? $smaller_dimension : $smaller_dimension; - imageellipse($im, $width/2, $height/2, $smaller_dimension, $smaller_dimension, $color); + imageellipse($im, $width / 2, $height / 2, $smaller_dimension, $smaller_dimension, $color); $save_function = 'image'. ($extension == 'jpg' ? 'jpeg' : $extension); $save_function($im, $destination); diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php index e6451e5..491eab7 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php @@ -113,6 +113,9 @@ public function getSettableOptions(AccountInterface $account = NULL) { return $this->getPossibleOptions($account); } + /** + * {@inheritdoc} + */ public function generate() { if ($allowed = $this->getPossibleValues()) { $values['value'] = array_rand(array_flip($allowed));