Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 1: <?php
 2: 
 3: /*
 4:  * This file is part of SwiftMailer.
 5:  * (c) 2004-2009 Chris Corbyn
 6:  *
 7:  * For the full copyright and license information, please view the LICENSE
 8:  * file that was distributed with this source code.
 9:  */
10: 
11: /**
12:  * Provides fixed-width byte sizes for reading fixed-width character sets.
13:  * @package Swift
14:  * @subpackage Encoder
15:  * @author Chris Corbyn
16:  * @author Xavier De Cock <xdecock@gmail.com>
17:  */
18: class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader
19: {
20:     /**
21:      * The number of bytes in a single character.
22:      * @var int
23:      * @access private
24:      */
25:     private $_width;
26: 
27:     /**
28:      * Creates a new GenericFixedWidthReader using $width bytes per character.
29:      * @param int $width
30:      */
31:     public function __construct($width)
32:     {
33:         $this->_width = $width;
34:     }
35: 
36:     /**
37:      * Returns the complete charactermap
38:      *
39:      * @param string $string
40:      * @param int    $startOffset
41:      * @param array  $currentMap
42:      * @param mixed  $ignoredChars
43:      * @return $int
44:      */
45:     public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
46:     {
47:         $strlen = strlen($string);
48:         // % and / are CPU intensive, so, maybe find a better way
49:         $ignored = $strlen%$this->_width;
50:         $ignoredChars = substr($string, - $ignored);
51:         $currentMap = $this->_width;
52: 
53:         return ($strlen - $ignored)/$this->_width;
54:     }
55: 
56:     /**
57:      * Returns mapType
58:      * @return int mapType
59:      */
60:     public function getMapType()
61:     {
62:         return self::MAP_TYPE_FIXED_LEN;
63:     }
64: 
65:     /**
66:      * Returns an integer which specifies how many more bytes to read.
67:      * A positive integer indicates the number of more bytes to fetch before invoking
68:      * this method again.
69:      * A value of zero means this is already a valid character.
70:      * A value of -1 means this cannot possibly be a valid character.
71:      * @param  string $bytes
72:      * @return int
73:      */
74:     public function validateByteSequence($bytes, $size)
75:     {
76:         $needed = $this->_width - $size;
77: 
78:         return ($needed > -1) ? $needed : -1;
79:     }
80: 
81:     /**
82:      * Returns the number of bytes which should be read to start each character.
83:      * @return int
84:      */
85:     public function getInitialByteSize()
86:     {
87:         return $this->_width;
88:     }
89: }
90: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen