comparison vendor/psy/psysh/src/Input/CodeArgument.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents
children
comparison
equal deleted inserted replaced
12:7a779792577d 13:5fb285c0d0e3
1 <?php
2
3 /*
4 * This file is part of Psy Shell.
5 *
6 * (c) 2012-2018 Justin Hileman
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Psy\Input;
13
14 use Symfony\Component\Console\Input\InputArgument;
15
16 /**
17 * An input argument for code.
18 *
19 * A CodeArgument must be the final argument of the command. Once all options
20 * and other arguments are used, any remaining input until the end of the string
21 * is considered part of a single CodeArgument, regardless of spaces, quoting,
22 * escaping, etc.
23 *
24 * This means commands can support crazy input like
25 *
26 * parse function() { return "wheee\n"; }
27 *
28 * ... without having to put the code in a quoted string and escape everything.
29 */
30 class CodeArgument extends InputArgument
31 {
32 /**
33 * Constructor.
34 *
35 * @param string $name The argument name
36 * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL
37 * @param string $description A description text
38 * @param mixed $default The default value (for self::OPTIONAL mode only)
39 *
40 * @throws \InvalidArgumentException When argument mode is not valid
41 */
42 public function __construct($name, $mode = null, $description = '', $default = null)
43 {
44 if ($mode & InputArgument::IS_ARRAY) {
45 throw new \InvalidArgumentException('Argument mode IS_ARRAY is not valid');
46 }
47
48 parent::__construct($name, $mode, $description, $default);
49 }
50 }