original_string: public static function create($properties, $checkcapability = true) {
          if (is_array($properties)) {
              $properties = (object)$properties;
          }
          if (!is_object($properties)) {
              throw new \coding_exception('When creating an event properties should be either an object or an assoc array');
          }
          $event = new calendar_event($properties);
          if ($event->update($properties, $checkcapability)) {
              return $event;
          } else {
              return false;
          }
      }
code: public static function create($properties, $checkcapability = true) {
          if (is_array($properties)) {
              $properties = (object)$properties;
          }
          if (!is_object($properties)) {
              throw new \coding_exception('When creating an event properties should be either an object or an assoc array');
          }
          $event = new calendar_event($properties);
          if ($event->update($properties, $checkcapability)) {
              return $event;
          } else {
              return false;
          }
      }
code_tokens: public static function create ( $ properties , $ checkcapability = true ) { if ( is_array ( $ properties ) ) { $ properties = ( object ) $ properties ; } if ( ! is_object ( $ properties ) ) { throw new \ coding_exception ( 'When creating an event properties should be either an object or an assoc array' ) ; } $ event = new calendar_event ( $ properties ) ; if ( $ event -> update ( $ properties , $ checkcapability ) ) { return $ event ; } else { return false ; } }
docstring: Creates a new event and returns an event object.
  
  Capability checking should be performed if the user is directly creating the event
  and no other capability has been tested. However if the event is not being created
  directly by the user and another capability has been checked for them to do this then
  capabilites should not be checked.
  
  For example if a user is creating an event in the calendar the check should be true,
  but if you are creating an event in an activity when it is created then the calendar
  capabilites should not be checked.
  
  @param \stdClass|array $properties An object containing event properties
  @param bool $checkcapability If Moodle should check the user can manage the calendar events for this call or not.
  @throws \coding_exception
  
  @return calendar_event|bool The event object or false if it failed
docstring_tokens: Creates a new event and returns an event object .