diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php |
first commit
Diffstat (limited to 'bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php')
-rw-r--r-- | bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php b/bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php new file mode 100644 index 00000000..b6ba7845 --- /dev/null +++ b/bin/wiki/vendor/addwiki/mediawiki-datamodel/src/EditInfo.php @@ -0,0 +1,79 @@ +<?php + +namespace Mediawiki\DataModel; + +use InvalidArgumentException; + +/** + * Represents flags that can be used when edits are made + * @author Addshore + */ +class EditInfo { + + //minor flags + const MINOR = true; + const NOTMINOR = false; + //bot flags + const BOT = true; + const NOTBOT = false; + + /** + * @var EditInfo::MINOR|self::NOTMINOR + */ + protected $minor = false; + + /** + * @var EditInfo::BOT|self::NOTBOT + */ + protected $bot = false; + + /** + * @var string + */ + protected $summary = null; + + /** + * @param string $summary + * @param bool $minor + * @param bool $bot + * + * @throws InvalidArgumentException + */ + public function __construct( $summary = '', $minor = self::NOTMINOR, $bot = self::NOTBOT ) { + if( !is_string( $summary ) ) { + throw new InvalidArgumentException( '$summary must be a string' ); + } + if( !is_bool( $minor ) ) { + throw new InvalidArgumentException( '$minor must be a bool' ); + } + if( !is_bool( $bot ) ) { + throw new InvalidArgumentException( '$bot must be a bool' ); + } + + $this->summary = $summary; + $this->bot = $bot; + $this->minor = $minor; + } + + /** + * @return EditInfo::BOT|self::NOTBOT + */ + public function getBot() { + return $this->bot; + } + + /** + * @return EditInfo::MINOR|self::NOTMINOR + */ + public function getMinor() { + return $this->minor; + } + + /** + * @return string + */ + public function getSummary() { + return $this->summary; + } + +}
\ No newline at end of file |