Data Types ########## .. highlight:: php .. versionadded:: 5.0 empty() All data types are immutable. All lists implement ``Traversable``, ``Countable`` and a read only ``ArrayAccess`` with numeric keys and have an ``empty()`` method. All lists wipe duplicates. .. _type_AnnounceList: AnnounceList ============ ``AnnounceList`` is a list of ``UriList``'s. It represents the outer list in the ``announce-list`` field in the torrent file. Creation -------- Announce list can be created from the following structures:: toArray(); // toArrayOfUriLists() return array of UriList objects $lists = $announceList->toArrayOfUriLists(); Node ==== ``Node`` represents an item in the DHT nodes list. Creation -------- :: host; // node host or ip $port = $node->port; // node port // also with array access that mimics the representation in the torrent file $host = $node[0]; $port = $node[1]; Array representation -------------------- :: toArray(); .. _type_NodeList: NodeList ======== ``NodeList`` is a list of ``Node``'s. It represents the ``nodes`` field in the torrent file. Creation -------- Node list can be created from the following structures:: toArray(); // toArrayOfNodes() return array of Node objects $nodes = $nodeList->toArrayOfNodes(); .. _type_UriList: UriList ======= ``UriList`` is a list of strings. It represents the ``url-list`` and ``httpseeds`` fields and the inner lists in the ``announce-list`` field in the torrent file. Creation -------- Uri list can be created from the following structures:: toArray(); .. _type_Attributes: Attributes ========== Attributes class represents file attibutes in file lists. Any single character attribute may be set for future compatibility:: attributes->a; // or $isA = $file->attributes->has('a'); Actual meaningful attributes:: attributes->x; // or $isExecutable = $file->attributes->has('x'); // or $isExecutable = $file->attributes->executable; /* Symlink: */ $isSymlink = $file->attributes->l; // or $isSymlink = $file->attributes->has('l'); // or $isSymlink = $file->attributes->symlink; /* Pad file: */ $isPad = $file->attributes->p; // or $isPad = $file->attributes->has('p'); // or $isPad = $file->attributes->pad; /* Hidden file: */ $isPad = $file->attributes->h; // or $isPad = $file->attributes->has('h'); // or $isPad = $file->attributes->hidden; Signature ========= :: signature; // signature value $signature->certificate; // cert as an object (if present) $signature->certificatePem; // cert in pem format (if present) $signature->certificateDer; // cert in der format (if present) $signature->info; // info (if present)