original_string: protected function checkType($expectedType, $value, $nullAllowed = false)
      {
          $invalidType = null;
          $valueType = gettype($value);
          $nullAllowed = (boolean) $nullAllowed;
  
          if ($valueType === 'object') {
              if (!is_a($value, $expectedType)) {
                  $invalidType = get_class($value);
              }
          } elseif ($expectedType !== $valueType) {
              $invalidType = $valueType;
          }
  
          if ($invalidType !== null && ($nullAllowed === false || ($nullAllowed === true && $value !== null))) {
              throw new CmisInvalidArgumentException(
                  sprintf(
                      'Argument of type "%s" given but argument of type "%s" was expected.',
                      $invalidType,
                      $expectedType
                  ),
                  1413440336
              );
          }
  
          return true;
      }
code: protected function checkType($expectedType, $value, $nullAllowed = false)
      {
          $invalidType = null;
          $valueType = gettype($value);
          $nullAllowed = (boolean) $nullAllowed;
  
          if ($valueType === 'object') {
              if (!is_a($value, $expectedType)) {
                  $invalidType = get_class($value);
              }
          } elseif ($expectedType !== $valueType) {
              $invalidType = $valueType;
          }
  
          if ($invalidType !== null && ($nullAllowed === false || ($nullAllowed === true && $value !== null))) {
              throw new CmisInvalidArgumentException(
                  sprintf(
                      'Argument of type "%s" given but argument of type "%s" was expected.',
                      $invalidType,
                      $expectedType
                  ),
                  1413440336
              );
          }
  
          return true;
      }
code_tokens: protected function checkType ( $ expectedType , $ value , $ nullAllowed = false ) { $ invalidType = null ; $ valueType = gettype ( $ value ) ; $ nullAllowed = ( boolean ) $ nullAllowed ; if ( $ valueType === 'object' ) { if ( ! is_a ( $ value , $ expectedType ) ) { $ invalidType = get_class ( $ value ) ; } } elseif ( $ expectedType !== $ valueType ) { $ invalidType = $ valueType ; } if ( $ invalidType !== null && ( $ nullAllowed === false || ( $ nullAllowed === true && $ value !== null ) ) ) { throw new CmisInvalidArgumentException ( sprintf ( 'Argument of type "%s" given but argument of type "%s" was expected.' , $ invalidType , $ expectedType ) , 1413440336 ) ; } return true ; }
docstring: Check if the given value is the expected object type
  
  @param string $expectedType the expected object type (class name)
  @param mixed $value The value that has to be checked
  @param boolean $nullAllowed Is <code>null</code> allowed as value?
  @return boolean returns <code>true</code> if the given value is instance of expected type
  @throws CmisInvalidArgumentException Exception is thrown if the given value does not match to the expected type
docstring_tokens: Check if the given value is the expected object type