Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded core and CertificateAuthority, added BitTorrent
- Loading branch information
Showing
8 changed files
with
398 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
namespace Quark\Extensions\BitTorrent; | ||
|
||
use Quark\IQuarkIOProcessor; | ||
|
||
use Quark\QuarkObject; | ||
use Quark\QuarkPlainIOProcessor; | ||
|
||
/** | ||
* Class BitTorrentEncode | ||
* | ||
* @package Quark\Extensions\BitTorrent | ||
*/ | ||
class BitTorrentEncode implements IQuarkIOProcessor { | ||
const MIME = 'application/x-bittorrent'; | ||
|
||
/** | ||
* @var bool $_plain = false | ||
*/ | ||
private $_plain = false; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function MimeType () { | ||
return $this->_plain ? QuarkPlainIOProcessor::MIME : self::MIME; | ||
} | ||
|
||
/** | ||
* @param $data | ||
* | ||
* @return string | ||
*/ | ||
public function Encode ($data) { | ||
if (is_bool($data)) return 'd' . ($data ? 1 : 0) . 'e'; | ||
if (is_int($data)) return 'd' . $data . 'e'; | ||
if (is_float($data)) return 'd' . ((int)$data) . 'e'; | ||
if (is_string($data)) return strlen($data) . ':' . $data; | ||
|
||
if (QuarkObject::isIterative($data)) { | ||
$out = 'l'; | ||
|
||
foreach ($data as $i => &$item) | ||
$out .= $this->Encode($item); | ||
|
||
unset($i , $item); | ||
|
||
return $out . 'e'; | ||
} | ||
|
||
if (QuarkObject::isAssociative($data)) { | ||
$out = 'd'; | ||
|
||
foreach ($data as $key => &$value) | ||
$out .= $this->Encode($key) . $this->Encode($value); | ||
|
||
unset($key , $value); | ||
|
||
return $out . 'e'; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* @param $raw | ||
* | ||
* @return mixed | ||
*/ | ||
public function Decode ($raw) { | ||
// TODO: Implement Decode() method. | ||
} | ||
|
||
/** | ||
* @param string $raw | ||
* @param bool $fallback | ||
* | ||
* @return mixed | ||
*/ | ||
public function Batch ($raw, $fallback) { | ||
return array($raw); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function ForceInput () { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...LAuthority/IQuarkSSLAuthorityProvider.php → ...ty/IQuarkCertificateAuthorityProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...thority/Providers/SelfSignedAuthority.php → ...thority/Providers/SelfSignedAuthority.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.