original_string: protected function isActionReadyToExecute($key, $args)
      {
          switch ($key) {
              case self::ADD:
                  $parentId  = $args[1];
                  $siblingId = $args[4];
  
                  return
                      !$parentId
                      || (
                          $this->rawLayoutBuilder->has($parentId)
                          && (!$siblingId || $this->rawLayoutBuilder->isParentFor($parentId, $siblingId))
                      );
              case self::MOVE:
                  list($id, $parentId, $siblingId) = $args;
  
                  return
                      (!$id || $this->rawLayoutBuilder->has($id))
                      && (!$parentId || $this->rawLayoutBuilder->has($parentId))
                      && (
                          !$siblingId
                          || ($parentId && $this->rawLayoutBuilder->isParentFor($parentId, $siblingId))
                          || (!$parentId && $this->rawLayoutBuilder->has($siblingId))
                      );
              case self::REMOVE:
              case self::SET_OPTION:
              case self::APPEND_OPTION:
              case self::SUBTRACT_OPTION:
              case self::REPLACE_OPTION:
              case self::REMOVE_OPTION:
              case self::CHANGE_BLOCK_TYPE:
                  $id = $args[0];
  
                  return !$id || $this->rawLayoutBuilder->has($id);
              case self::SET_BLOCK_THEME:
                  $id = $args[1];
  
                  return (!$id && !$this->rawLayoutBuilder->isEmpty()) || $this->rawLayoutBuilder->has($id);
              case self::ADD_ALIAS:
                  $id = $args[1];
  
                  return !$id || $this->rawLayoutBuilder->has($id);
              case self::REMOVE_ALIAS:
                  $alias = $args[0];
  
                  return !$alias || $this->rawLayoutBuilder->hasAlias($alias);
          }
  
          return true;
      }
code: protected function isActionReadyToExecute($key, $args)
      {
          switch ($key) {
              case self::ADD:
                  $parentId  = $args[1];
                  $siblingId = $args[4];
  
                  return
                      !$parentId
                      || (
                          $this->rawLayoutBuilder->has($parentId)
                          && (!$siblingId || $this->rawLayoutBuilder->isParentFor($parentId, $siblingId))
                      );
              case self::MOVE:
                  list($id, $parentId, $siblingId) = $args;
  
                  return
                      (!$id || $this->rawLayoutBuilder->has($id))
                      && (!$parentId || $this->rawLayoutBuilder->has($parentId))
                      && (
                          !$siblingId
                          || ($parentId && $this->rawLayoutBuilder->isParentFor($parentId, $siblingId))
                          || (!$parentId && $this->rawLayoutBuilder->has($siblingId))
                      );
              case self::REMOVE:
              case self::SET_OPTION:
              case self::APPEND_OPTION:
              case self::SUBTRACT_OPTION:
              case self::REPLACE_OPTION:
              case self::REMOVE_OPTION:
              case self::CHANGE_BLOCK_TYPE:
                  $id = $args[0];
  
                  return !$id || $this->rawLayoutBuilder->has($id);
              case self::SET_BLOCK_THEME:
                  $id = $args[1];
  
                  return (!$id && !$this->rawLayoutBuilder->isEmpty()) || $this->rawLayoutBuilder->has($id);
              case self::ADD_ALIAS:
                  $id = $args[1];
  
                  return !$id || $this->rawLayoutBuilder->has($id);
              case self::REMOVE_ALIAS:
                  $alias = $args[0];
  
                  return !$alias || $this->rawLayoutBuilder->hasAlias($alias);
          }
  
          return true;
      }
code_tokens: protected function isActionReadyToExecute ( $ key , $ args ) { switch ( $ key ) { case self :: ADD : $ parentId = $ args [ 1 ] ; $ siblingId = $ args [ 4 ] ; return ! $ parentId || ( $ this -> rawLayoutBuilder -> has ( $ parentId ) && ( ! $ siblingId || $ this -> rawLayoutBuilder -> isParentFor ( $ parentId , $ siblingId ) ) ) ; case self :: MOVE : list ( $ id , $ parentId , $ siblingId ) = $ args ; return ( ! $ id || $ this -> rawLayoutBuilder -> has ( $ id ) ) && ( ! $ parentId || $ this -> rawLayoutBuilder -> has ( $ parentId ) ) && ( ! $ siblingId || ( $ parentId && $ this -> rawLayoutBuilder -> isParentFor ( $ parentId , $ siblingId ) ) || ( ! $ parentId && $ this -> rawLayoutBuilder -> has ( $ siblingId ) ) ) ; case self :: REMOVE : case self :: SET_OPTION : case self :: APPEND_OPTION : case self :: SUBTRACT_OPTION : case self :: REPLACE_OPTION : case self :: REMOVE_OPTION : case self :: CHANGE_BLOCK_TYPE : $ id = $ args [ 0 ] ; return ! $ id || $ this -> rawLayoutBuilder -> has ( $ id ) ; case self :: SET_BLOCK_THEME : $ id = $ args [ 1 ] ; return ( ! $ id && ! $ this -> rawLayoutBuilder -> isEmpty ( ) ) || $ this -> rawLayoutBuilder -> has ( $ id ) ; case self :: ADD_ALIAS : $ id = $ args [ 1 ] ; return ! $ id || $ this -> rawLayoutBuilder -> has ( $ id ) ; case self :: REMOVE_ALIAS : $ alias = $ args [ 0 ] ; return ! $ alias || $ this -> rawLayoutBuilder -> hasAlias ( $ alias ) ; } return true ; }
docstring: Checks whether an action is ready to execute
  
  @param string $key  The action key
  @param array  $args The action arguments
  
  @return bool
  
  @SuppressWarnings(PHPMD.CyclomaticComplexity)
docstring_tokens: Checks whether an action is ready to execute