Class: Docs::Php::EntriesFilter

Inherits:
EntriesFilter show all
Defined in:
lib/docs/filters/php/entries.rb

Constant Summary collapse

TYPE_BY_NAME_STARTS_WITH =
{
'ArrayObject'     => 'SPL',
'Collectable'     => 'pthreads',
'Cond'            => 'pthreads',
'CURL'            => 'cURL',
'Date'            => 'Date/Time',
'ErrorException'  => 'Predefined Exceptions',
'Exception'       => 'Predefined Exceptions',
'Json'            => 'JSON',
'Http'            => 'HTTP',
'Mutex'           => 'pthreads',
'php_user_filter' => 'Stream',
'Pool'            => 'pthreads',
'Reflector'       => 'Reflection',
'Soap'            => 'SOAP',
'SplFile'         => 'SPL/File',
'SplTempFile'     => 'SPL/File',
'Spl'             => 'SPL',
'Stackable'       => 'pthreads',
'streamWrapper'   => 'Stream',
'Thread'          => 'pthreads',
'tidy'            => 'Tidy',
'Worker'          => 'pthreads',
'XsltProcessor'   => 'XSLT',
'ZipArchive'      => 'Zip' }
REPLACE_TYPES =
{
'Exceptions'        => 'SPL/Exceptions',
'GD and Image'      => 'Image',
'Gmagick'           => 'Image/GraphicsMagick',
'Imagick'           => 'Image/ImageMagick',
'Interfaces'        => 'SPL/Interfaces',
'Iterators'         => 'SPL/Iterators',
'mysqli'            => 'Database/MySQL',
'PostgreSQL'        => 'Database/PostgreSQL',
'Session'           => 'Sessions',
'Session PgSQL'     => 'Database/PostgreSQL',
'SQLite3'           => 'Database/SQLite',
'SQLSRV'            => 'Database/SQL Server',
'Stream'            => 'Streams',
'Yaml'              => 'YAML' }
TYPE_GROUPS =
{
'Classes and Functions' => ['Classes/Object', 'Function handling', 'Predefined Interfaces and Classes', 'runkit'],
'Encoding'              => ['Gettext', 'iconv', 'Multibyte String'],
'Compression'           => ['Bzip2', 'Zip', 'Zlib'],
'Cryptography'          => ['Hash', 'Mcrypt', 'OpenSSL', 'Password Hashing'],
'Database'              => ['DBA', 'ODBC', 'PDO'],
'Date and Time'         => ['Calendar', 'Date/Time'],
'Errors'                => ['Error Handling', 'Predefined Exceptions'],
'File System'           => ['Directory', 'Fileinfo', 'Filesystem', 'Inotify'],
'HTML'                  => ['DOM', 'Tidy'],
'Language'              => ['Control Structures', 'Misc.', 'PHP Options/Info', 'Predefined Variables'],
'Mail'                  => ['Mail', 'Mailparse'],
'Mathematics'           => ['BC Math', 'Math', 'Statistic'],
'Networking'            => ['GeoIP', 'Network', 'Output Control', 'SSH2', 'Socket', 'URL'],
'Process Control'       => ['Eio', 'Libevent', 'POSIX', 'Program execution', 'pthreads'],
'String'                => ['Ctype', 'PCRE', 'POSIX Regex', 'Taint'],
'Variables'             => ['Filter', 'Variable handling'],
'XML'                   => ['libxml', 'SimpleXML', 'XML Parser', 'XML-RPC', 'XMLReader', 'XMLWriter', 'XSLT'] }

Constants inherited from Filter

Filter::SCHEME_RGX

Instance Method Summary collapse

Methods inherited from EntriesFilter

#additional_entries, #build_entries, #build_entry, #call, #default_entry, #entries, #name, #path, #type

Methods inherited from Filter

#absolute_url_string?, #at_css, #at_xpath, #base_url, #css, #current_url, #fragment_url_string?, #initial_page?, #parse_html, #relative_url_string?, #root_page?, #root_path, #root_url, #slug, #subpath, #subpath_to, #xpath

Instance Method Details

#get_nameObject


83
84
85
86
87
88
89
90
# File 'lib/docs/filters/php/entries.rb', line 83

def get_name
  return 'IntlException' if slug == 'class.intlexception'
  name = css('> .sect1 > .title', 'h1', 'h2').first.content
  name.remove! 'The '
  name.sub! ' class', ' (class)'
  name.sub! ' interface', ' (interface)'
  name
end

#get_typeObject


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/docs/filters/php/entries.rb', line 92

def get_type
  type = at_css('.up').content.strip
  type = 'SPL/Iterators' if type.end_with? 'Iterator'
  type.remove! ' Functions'

  TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value|
    break type = value if name.start_with?(key)
  end

  TYPE_GROUPS.each_pair do |replacement, types|
    types.each do |t|
      return replacement if type == t
    end
  end

  REPLACE_TYPES[type] || type
end

#include_default_entry?Boolean

Returns:

  • (Boolean)

110
111
112
# File 'lib/docs/filters/php/entries.rb', line 110

def include_default_entry?
  !initial_page? && doc.at_css('.reference', '.refentry', '.sect1')
end