How to use the :: syntax

In the docs it says here https://learn.getgrav.org/content/collections#programmatic-collections
that "Collection::order($by, $dir, $manual) - Orders the current collection"

I can’t find a way to make this work. Please could somebody explain the syntax with an example of using :: ?

Class::methiod is a short way to indicate a method inside a class. It’s not a valid syntax to be used anywhere (except when the method is static).

Actual usage depends on where you want to use it. In Twig, use collection.order(), in PHP use $collection->order()

Thanks Flavio. Success at last. For anyone else trying to re-order a collection programmatically in a Twig template, try this:

{% set collection = page.evaluate([{'@page.children':'/crimebooks'}]) %}
{% set orderedcoll = collection.order('header.pub','asc') %}

Where pub is a header variable containing an integer. This code creates a new collection collection from the children of the page /crimebooks and then creates another collection orderedcoll which has been put into ascending order of the value of the header variable pub (publication date in my case).

The code can probably be made more elegant but it works. Thanks again.

update the docs with similar reference: https://learn.getgrav.org/content/collections#php-collections