Skip to content

Commit

Permalink
Update PhutilSwiftFuture.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Universal-Omega authored Dec 21, 2022
1 parent 19c888a commit f7370ae
Showing 1 changed file with 37 additions and 37 deletions.
74 changes: 37 additions & 37 deletions swift/PhutilSwiftFuture.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,78 @@ final class PhutilSwiftFuture extends PhutilOpenstackFuture {
private $container;

public function getServiceName() {
return 'swift';
return 'swift';
}

public function setContainer( $container ) {
$this->container = $container;
return $this;
$this->container = $container;
return $this;
}

/**
* Get the container name to use for storing a given key
*/
public function getContainer( $key = '' ) {
$key_prefix = $key;
if ( strlen( $key_prefix ) >= 2 ) {
$key_prefix = '-' . substr( $key_prefix, 0, 2 );
return $this->container . $key_prefix;
} else {
return $this->container;
}
$key_prefix = $key;
if ( strlen( $key_prefix ) >= 2 ) {
$key_prefix = '-' . substr( $key_prefix, 0, 2 );
return $this->container . $key_prefix;
} else {
return $this->container;
}
}

public function setParametersForGetObject( $key ) {
$container = $this->getContainer( $key );
$container = $this->getContainer( $key );

$this->setHTTPMethod( 'GET' );
$this->setPath( $container . '/' . $key );
$this->setHTTPMethod( 'GET' );
$this->setPath( $container . '/' . $key );

return $this;
return $this;
}

public function setParametersForPutContainer( $key ) {
$container = $this->getContainer( $key );
$container = $this->getContainer( $key );

$this->setHTTPMethod( 'PUT' );
$this->setPath( $container );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );
return $this;
$this->setHTTPMethod( 'PUT' );
$this->setPath( $container );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );
return $this;
}

public function setParametersForPutObject( $key, $value ) {
$container = $this->getContainer( $key );
$container = $this->getContainer( $key );

$this->setHTTPMethod( 'PUT' );
$this->setPath( $container . '/' . $key );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );
$this->addHeader( 'Content-Type', 'application/octet-stream' );
$this->setHTTPMethod( 'PUT' );
$this->setPath( $container . '/' . $key );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );
$this->addHeader( 'Content-Type', 'application/octet-stream' );

$this->setData( $value );
return $this;
$this->setData( $value );
return $this;
}

public function setParametersForDeleteObject( $key ) {
$container = $this->getContainer( $key );
$container = $this->getContainer( $key );

$this->setHTTPMethod( 'DELETE' );
$this->setPath( $container . '/' . $key );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );
$this->setHTTPMethod( 'DELETE' );
$this->setPath( $container . '/' . $key );
$this->addHeader( 'X-Auth-Token', $this->getSecretKey() );

return $this;
return $this;
}

protected function didReceiveResult( $result ) {
list( $status, $body, $headers ) = $result;
list( $status, $body, $headers ) = $result;

if ( !$status->isError() ) {
return $body;
}
if ( !$status->isError() ) {
return $body;
}

return parent::didReceiveResult( $result );
return parent::didReceiveResult( $result );
}

protected function shouldSignContent() {
return false;
return false;
}
}

0 comments on commit f7370ae

Please sign in to comment.