original_string: public function addReport($idSite, $description, $period, $hour, $reportType, $reportFormat, $reports, $parameters, $idSegment = false, $evolutionPeriodFor = 'prev',
                                $evolutionPeriodN = null)
      {
          Piwik::checkUserIsNotAnonymous();
          Piwik::checkUserHasViewAccess($idSite);
  
          $currentUser = Piwik::getCurrentUserLogin();
          self::ensureLanguageSetForUser($currentUser);
  
          self::validateCommonReportAttributes($period, $hour, $description, $idSegment, $reportType, $reportFormat, $evolutionPeriodFor, $evolutionPeriodN);
  
          // report parameters validations
          $parameters = self::validateReportParameters($reportType, $parameters);
  
          // validation of requested reports
          $reports = self::validateRequestedReports($idSite, $reportType, $reports);
  
          $idReport = $this->getModel()->createReport(array(
               'idsite'      => $idSite,
               'login'       => $currentUser,
               'description' => $description,
               'idsegment'   => $idSegment,
               'period'      => $period,
               'hour'        => $hour,
               'type'        => $reportType,
               'format'      => $reportFormat,
               'parameters'  => $parameters,
               'reports'     => $reports,
               'ts_created'  => Date::now()->getDatetime(),
               'deleted'     => 0,
               'evolution_graph_within_period' => $evolutionPeriodFor == 'each',
               'evolution_graph_period_n' => $evolutionPeriodN ?: ImageGraph::getDefaultGraphEvolutionLastPeriods(),
          ));
  
          return $idReport;
      }
code: public function addReport($idSite, $description, $period, $hour, $reportType, $reportFormat, $reports, $parameters, $idSegment = false, $evolutionPeriodFor = 'prev',
                                $evolutionPeriodN = null)
      {
          Piwik::checkUserIsNotAnonymous();
          Piwik::checkUserHasViewAccess($idSite);
  
          $currentUser = Piwik::getCurrentUserLogin();
          self::ensureLanguageSetForUser($currentUser);
  
          self::validateCommonReportAttributes($period, $hour, $description, $idSegment, $reportType, $reportFormat, $evolutionPeriodFor, $evolutionPeriodN);
  
          // report parameters validations
          $parameters = self::validateReportParameters($reportType, $parameters);
  
          // validation of requested reports
          $reports = self::validateRequestedReports($idSite, $reportType, $reports);
  
          $idReport = $this->getModel()->createReport(array(
               'idsite'      => $idSite,
               'login'       => $currentUser,
               'description' => $description,
               'idsegment'   => $idSegment,
               'period'      => $period,
               'hour'        => $hour,
               'type'        => $reportType,
               'format'      => $reportFormat,
               'parameters'  => $parameters,
               'reports'     => $reports,
               'ts_created'  => Date::now()->getDatetime(),
               'deleted'     => 0,
               'evolution_graph_within_period' => $evolutionPeriodFor == 'each',
               'evolution_graph_period_n' => $evolutionPeriodN ?: ImageGraph::getDefaultGraphEvolutionLastPeriods(),
          ));
  
          return $idReport;
      }
code_tokens: public function addReport ( $ idSite , $ description , $ period , $ hour , $ reportType , $ reportFormat , $ reports , $ parameters , $ idSegment = false , $ evolutionPeriodFor = 'prev' , $ evolutionPeriodN = null ) { Piwik :: checkUserIsNotAnonymous ( ) ; Piwik :: checkUserHasViewAccess ( $ idSite ) ; $ currentUser = Piwik :: getCurrentUserLogin ( ) ; self :: ensureLanguageSetForUser ( $ currentUser ) ; self :: validateCommonReportAttributes ( $ period , $ hour , $ description , $ idSegment , $ reportType , $ reportFormat , $ evolutionPeriodFor , $ evolutionPeriodN ) ; // report parameters validations $ parameters = self :: validateReportParameters ( $ reportType , $ parameters ) ; // validation of requested reports $ reports = self :: validateRequestedReports ( $ idSite , $ reportType , $ reports ) ; $ idReport = $ this -> getModel ( ) -> createReport ( array ( 'idsite' => $ idSite , 'login' => $ currentUser , 'description' => $ description , 'idsegment' => $ idSegment , 'period' => $ period , 'hour' => $ hour , 'type' => $ reportType , 'format' => $ reportFormat , 'parameters' => $ parameters , 'reports' => $ reports , 'ts_created' => Date :: now ( ) -> getDatetime ( ) , 'deleted' => 0 , 'evolution_graph_within_period' => $ evolutionPeriodFor == 'each' , 'evolution_graph_period_n' => $ evolutionPeriodN ? : ImageGraph :: getDefaultGraphEvolutionLastPeriods ( ) , ) ) ; return $ idReport ; }
docstring: Creates a new report and schedules it.
  
  @param int $idSite
  @param string $description Report description
  @param string $period Schedule frequency: day, week or month
  @param int $hour Hour (0-23) when the report should be sent
  @param string $reportType 'email' or any other format provided via the ScheduledReports.getReportTypes hook
  @param string $reportFormat 'pdf', 'html' or any other format provided via the ScheduledReports.getReportFormats hook
  @param array $reports array of reports
  @param array $parameters array of parameters
  @param bool|int $idSegment Segment Identifier
  @param string $evolutionPeriodFor If set to 'each', the evolution graphs cover each day within the period. If set to 'prev',
  evolution graphs cover the previous N periods.
  @param int|null $evolutionPeriodN The previous N periods to query in evolution graphs if $evolutionPeriodFor is 'each'.
  
  @return int idReport generated
docstring_tokens: Creates a new report and schedules it .