Before 2.12.0 Piwik stored this list as an array mapping year months to arrays of site IDs. If this is
found in the DB, we convert the array to an array of year months to avoid errors and to make sure
the correct tables are still purged.
6795
private function convertOldDistributedList(&$yearMonths)
    {
        foreach ($yearMonths as $key => $value) {
            if (preg_match("/^[0-9]{4}_[0-9]{2}$/", $key)) {
                unset($yearMonths[$key]);

                $yearMonths[] = $key;
            }
        }
    }
1090218
public function monthArray($begin, $end, $year = '')
    {
        if (empty($year)) {
            $year = date('Y');
        }
        $dateArray = array();
        for ($i = $begin; $i <= $end; ++$i) {
            $dateArray[] = $i;
        }
        return $dateArray;
    }
883578
function (id) {
    var todos = [];
    for (var i in _todos) {
      if (_todos[i].todo_list_id === id) {
        todos.push(_todos[i]);
      }
    }
    return todos;
  }
183317
function getYearsList() {
            var yearsList = [];
            for (var i = 2005; i <= moment().year(); i++) {
                yearsList.push(i);
            }
            return yearsList;
        }
863021
private function getNumberOfVisitsPiwik($block_id, $period='year'){
    
        $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url');
        $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid');
        $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token');
    
        if($piwik_url && strlen($piwik_url) > 0 &&
            $piwik_siteid  && strlen($piwik_siteid) > 0 &&
            $piwik_token && strlen($piwik_token)            
            ) 
        {        
            // calling Piwik REST API
            $url = $piwik_url;
            $url .= '?module=API&method=VisitsSummary.getVisits';
            $url .= '&idSite='.$piwik_siteid.'&period='.$period.'&date=today';
            $url .= '&format=PHP';
            $url .= '&token_auth='.$piwik_token;
        
            if($fetched = File::fetchUrl($url)) {
                $content = @unserialize($fetched);
                if(is_numeric($content)) return $content;
            }
        }
    
        return null;
    }
1142758
private Date[] convertLongArrayToDateArray(final Long[] source) {

		final ArrayList<Date> result = new ArrayList<>();

		for (final Long o : source) {
			
			result.add(new Date(o));
		}

		return (Date[])result.toArray(new Date[result.size()]);
	}
1118793
def get_site_symmetries(wyckoff):
    

    ssyms = []
    for w in wyckoff:
        ssyms += ["\"%-6s\"" % w_s['site_symmetry'] for w_s in w['wyckoff']]

    damp_array_site_symmetries(ssyms)
1128095
private static Integer[] getAdjustedMonthLength(int year) {
        Integer[] newMonths;
        try {
            newMonths = ADJUSTED_MONTH_LENGTHS.get(Integer.valueOf(year));
        } catch (ArrayIndexOutOfBoundsException e) {
            newMonths = null;
        }
        if (newMonths == null) {
            if (isLeapYear(year)) {
                newMonths = DEFAULT_LEAP_MONTH_LENGTHS;
            } else {
                newMonths = DEFAULT_MONTH_LENGTHS;
            }
        }
        return newMonths;
    }
993976
public function toArray($ignore = ['pages', 'containers', 'sitePlugins'])
    {
        $data = parent::toArray($ignore);

        if (!in_array('pages', $ignore)) {
            $data['pages'] = $this->modelArrayToArray(
                $this->getPages()->toArray(),
                ['parent', 'site', 'revisions']
            );
        }

        if (!in_array('containers', $ignore)) {
            $data['containers'] = $this->modelArrayToArray(
                $this->getContainers()->toArray(),
                ['parent', 'site', 'revisions']
            );
        }

        if (!in_array('domainId', $ignore)) {
            $data['domainId'] = $this->getDomainId();
        }
        if (!in_array('domainName', $ignore)) {
            $data['domainName'] = $this->getDomainName();
        }
        if (!in_array('languageId', $ignore)) {
            $data['languageId'] = $this->getLanguageId();
        }
        if (!in_array('languageIso6392t', $ignore)) {
            $data['languageIso6392t'] = $this->getLanguageIso6392t();
        }
        if (!in_array('countryId', $ignore)) {
            $data['countryId'] = $this->getCountryId();
        }
        if (!in_array('locale', $ignore)) {
            $data['locale'] = $this->getLocale();
        }

        return $data;
    }
98981
def blog_months(*args):
    
    dates = BlogPost.objects.published().values_list("publish_date", flat=True)
    date_dicts = [{"date": datetime(d.year, d.month, 1)} for d in dates]
    month_dicts = []
    for date_dict in date_dicts:
        if date_dict not in month_dicts:
            month_dicts.append(date_dict)
    for i, date_dict in enumerate(month_dicts):
        month_dicts[i]["post_count"] = date_dicts.count(date_dict)
    return month_dicts
263706
def to_a
      result = []
      @domains.values.each do |paths|
        paths.values.each do |cookies|
          cookies.values.inject result, :<<
        end
      end
      result
    end
105877
def _save_until_eos(ids, skip=False):
  """"""
  ids = ids.flatten()
  if skip:
    return ids
  try:
    index = list(ids).index(text_encoder.EOS_ID)
    return ids[0:index]
  except ValueError:
    # No EOS_ID: return the array as-is.
    return ids
805949
function arrayToList ( arr ) {
	const length = arr.length;
	const data = new types.List(length);
	for ( let i = 0; i < length; i++ ) {
		data.setValue(i, setJsonValueToSassValue(arr[i]));
	}
	return data;
}
491572
private static function prepareRows($values, $modelId, $propertyId, $valueField, $langId = 0)
    {
        if (true === empty($values)) {
            return [];
        }
        $rows = [];
        foreach ((array) $values as $index => $value) {
            if ($value !== 0 && true === empty($value)) {
                continue;
            }
            $rows[] = [
                $modelId,
                $propertyId,
                $index,
                $valueField === 'value_integer' ? (int) $value : null,
                $valueField === 'value_float' ? (float) $value : null,
                $valueField === 'value_string' ? $value : '',
                $valueField === 'value_text' ? $value : '',
                $langId,
            ];
        }
        return $rows;
    }
898723
private function formatListForApi(array $list)
    {
        $values = [];

        foreach ($list as $value) {
            $values[] = $this->formatValueForApi($value);
        }

        return ['values' => $values];
    }
1206325
public static <T> List<T> toList(final T[] array) {

    if (array != null) {
      List<T> list = new ArrayList<T>(array.length);
      for (T element : array) {
        list.add(element);
      }
      return list;
    } else {
      return new ArrayList<T>(0);
    }
  }
99165
public function getDirtyRawAttributes(): array
    {
        $attributes = $this->getRawAttributes();

        $cachedAttributes = $this->getCachedRawAttributes(array_keys($attributes));

        $dirty = [];

        foreach ($attributes as $key => $value) {
            if ($this->isActualRelation($key) || $key == 'pivot') {
                continue;
            }

            if (!array_key_exists($key, $cachedAttributes) && !$value instanceof Pivot) {
                $dirty[$key] = $value;
            } elseif ($value !== $cachedAttributes[$key] &&
                !$this->originalIsNumericallyEquivalent($value, $cachedAttributes[$key])) {
                $dirty[$key] = $value;
            }
        }

        return $dirty;
    }