示例#1
0
 /**
  * Create a new instance.
  *
  * @param string                $action   The action being performed.
  *
  * @param ModelIdInterface|null $parentId The id of the parent model (null for no parent).
  *
  * @param ModelIdInterface|null $modelId  The id of the model the action covers (may be null for "create" only).
  *
  * @throws \InvalidArgumentException When the action is not one of create, cut, copy or deep copy.
  */
 public function __construct($action, $parentId, $modelId)
 {
     parent::__construct($action, $parentId);
     if (!$modelId instanceof ModelIdInterface) {
         throw new \InvalidArgumentException('Invalid $modelId given.');
     }
     $this->modelId = $modelId;
 }
示例#2
0
 /**
  * Create a new instance.
  *
  * @param string                $action       The action being performed.
  *
  * @param ModelIdInterface|null $parentId     The id of the parent model (null for no parent).
  *
  * @param string                $providerName The provider name of the item being created.
  *
  * @throws \InvalidArgumentException When the action is not create.
  */
 public function __construct($action, $parentId, $providerName)
 {
     parent::__construct($action, $parentId);
     if ($action !== ItemInterface::CREATE) {
         throw new \InvalidArgumentException('UnsavedItem is designed for create actions only.');
     }
     $this->providerName = $providerName;
 }
示例#3
0
 /**
  * MockedAbstractItem constructor.
  *
  * @param string                       $action                The clipboard action name.
  * @param ModelIdInterface|null        $parentId              The parent id.
  * @param ModelIdInterface|string|null $modelIdOrProviderName The model id or provider name.
  */
 public function __construct($action, ModelIdInterface $parentId = null, $modelIdOrProviderName = null)
 {
     parent::__construct($action, $parentId);
     if ($modelIdOrProviderName instanceof ModelIdInterface) {
         $this->modelId = $modelIdOrProviderName;
     } else {
         $this->providerName = $modelIdOrProviderName;
     }
 }