Code Duplication    Length = 7-7 lines in 2 locations

src/Forms/Form.php 2 locations

@@ 1255-1261 (lines=7) @@
1252
     * @param string|bool $cast Cast type; One of the CAST_ constant definitions.
1253
     * Bool values will be treated as plain text flag.
1254
     */
1255
    public function sessionMessage($message, $type = ValidationResult::TYPE_ERROR, $cast = ValidationResult::CAST_TEXT)
1256
    {
1257
        $this->setMessage($message, $type, $cast);
1258
        $result = $this->getSessionValidationResult() ?: ValidationResult::create();
1259
        $result->addMessage($message, $type, null, $cast);
1260
        $this->setSessionValidationResult($result);
1261
    }
1262
1263
    /**
1264
     * Set an error to the session, for display next time this form is shown.
@@ 1271-1277 (lines=7) @@
1268
     * @param string|bool $cast Cast type; One of the CAST_ constant definitions.
1269
     * Bool values will be treated as plain text flag.
1270
     */
1271
    public function sessionError($message, $type = ValidationResult::TYPE_ERROR, $cast = ValidationResult::CAST_TEXT)
1272
    {
1273
        $this->setMessage($message, $type, $cast);
1274
        $result = $this->getSessionValidationResult() ?: ValidationResult::create();
1275
        $result->addError($message, $type, null, $cast);
1276
        $this->setSessionValidationResult($result);
1277
    }
1278
1279
    /**
1280
     * Returns the DataObject that has given this form its data