How to use Times class

Best Phake code snippet using Times

base.php

Source:base.php Github

copy

Full Screen

1<?php2namespace Elementor\Core\Logger\Items;3if ( ! defined( 'ABSPATH' ) ) {4 exit; // Exit if accessed directly5}6class Base implements Log_Item_Interface {7 const FORMAT = 'date [type] message [meta]';8 const TRACE_FORMAT = '#key: file(line): class type function()';9 const TRACE_LIMIT = 5;10 protected $date;11 protected $type;12 protected $message;13 protected $meta = [];14 protected $times = 0;15 protected $times_dates = [];16 protected $args = [];17 public function __construct( $args ) {18 $this->date = current_time( 'mysql' );19 $this->message = ! empty( $args['message'] ) ? esc_html( $args['message'] ) : '';20 $this->type = ! empty( $args['type'] ) ? $args['type'] : 'info';21 $this->meta = ! empty( $args['meta'] ) ? $args['meta'] : [];22 $this->args = $args;23 $this->set_trace();24 }25 public function __get( $name ) {26 if ( property_exists( $this, $name ) ) {27 return $this->{$name};28 }29 return '';30 }31 public function __toString() {32 $vars = get_object_vars( $this );33 return strtr( static::FORMAT, $vars );34 }35 public function jsonSerialize() {36 return [37 'class' => get_class( $this ),38 'item' => [39 'date' => $this->date,40 'message' => $this->message,41 'type' => $this->type,42 'meta' => $this->meta,43 'times' => $this->times,44 'times_dates' => $this->times_dates,45 'args' => $this->args,46 ],47 ];48 }49 public function deserialize( $properties ) {50 $this->date = ! empty( $properties['date'] ) && is_string( $properties['date'] ) ? $properties['date'] : '';51 $this->message = ! empty( $properties['message'] ) && is_string( $properties['message'] ) ? $properties['message'] : '';52 $this->type = ! empty( $properties['type'] ) && is_string( $properties['type'] ) ? $properties['type'] : '';53 $this->meta = ! empty( $properties['meta'] ) && is_array( $properties['meta'] ) ? $properties['meta'] : [];54 $this->times = ! empty( $properties['times'] ) && is_string( $properties['times'] ) ? $properties['times'] : '';55 $this->times_dates = ! empty( $properties['times_dates'] ) && is_array( $properties['times_dates'] ) ? $properties['times_dates'] : [];56 $this->args = ! empty( $properties['args'] ) && is_array( $properties['args'] ) ? $properties['args'] : [];57 }58 /**59 * @return Log_Item_Interface | null60 */61 public static function from_json( $str ) {62 $obj = json_decode( $str, true );63 if ( ! array_key_exists( 'class', $obj ) ) {64 return null;65 }66 $class = $obj['class'];67 if ( class_exists( $class ) ) {68 /** @var Base $item */69 $item = new $class( $obj['item']['message'] );70 $item->deserialize( $obj['item'] );71 return $item;72 }73 return null;74 }75 public function to_formatted_string( $output_format = 'html' ) {76 $vars = get_object_vars( $this );77 $format = static::FORMAT;78 if ( 'html' === $output_format ) {79 $format = str_replace( 'message', '<strong>message</strong>', static::FORMAT );80 }81 if ( empty( $vars['meta'] ) ) {82 $format = str_replace( '[meta]', '', $format );83 } else {84 $vars['meta'] = stripslashes( var_export( $vars['meta'], true ) ); // @codingStandardsIgnoreLine85 }86 return strtr( $format, $vars );87 }88 public function get_fingerprint() {89 $unique_key = $this->type . $this->message . var_export( $this->meta, true ); // @codingStandardsIgnoreLine90 //info messages are not be aggregated:91 if ( 'info' === $this->type ) {92 $unique_key .= $this->date;93 }94 return md5( $unique_key );95 }96 public function increase_times( $item, $truncate = true ) {97 $this->times++;98 $this->times_dates[] = $item->date;99 if ( $truncate && ( self::MAX_LOG_ENTRIES < count( $this->times_dates ) ) ) {100 $this->times_dates = array_slice( $this->times_dates, -self::MAX_LOG_ENTRIES );101 }102 }103 public function format( $format = 'html' ) {104 $trace = $this->format_trace();105 if ( empty( $trace ) ) {106 return $this->to_formatted_string( $format );107 }108 $copy = clone $this;109 $copy->meta['trace'] = $trace;110 return $copy->to_formatted_string( $format );111 }112 public function get_name() {113 return 'Log';114 }115 private function format_trace() {116 $trace = empty( $this->meta['trace'] ) ? '' : $this->meta['trace'];117 if ( is_string( $trace ) ) {118 return $trace;119 }120 $trace_str = '';121 foreach ( $trace as $key => $trace_line ) {122 $format = static::TRACE_FORMAT;123 $trace_line['key'] = $key;124 if ( empty( $trace_line['file'] ) ) {125 $format = str_replace( 'file(line): ', '', $format );126 }127 $trace_str .= PHP_EOL . strtr( $format, $trace_line );128 $trace_str .= empty( $trace_line['args'] ) ? '' : var_export( $trace_line['args'], true ); // @codingStandardsIgnoreLine129 }130 return $trace_str . PHP_EOL;131 }132 private function set_trace() {133 if ( ! empty( $this->args['trace'] ) && true === $this->args['trace'] ) {134 $limit = empty( $this->args['trace_limit'] ) ? static::TRACE_LIMIT : $this->args['trace_limit'];135 $stack = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // @codingStandardsIgnoreLine136 while ( ! empty( $stack ) && ! empty( $stack[0]['file'] ) && ( false !== strpos( $stack[0]['file'], 'core' . DIRECTORY_SEPARATOR . 'logger' ) ) ) {137 array_shift( $stack );138 }139 $this->meta['trace'] = array_slice( $stack, 0, $limit );140 return;141 }142 if ( is_array( $this->args ) ) {143 unset( $this->args['trace'] );144 }145 }146}...

Full Screen

Full Screen

dompdf_font_family_cache.dist.php

Source:dompdf_font_family_cache.dist.php Github

copy

Full Screen

...5 'italic' => DOMPDF_FONT_DIR . 'Helvetica-Oblique',6 'bold_italic' => DOMPDF_FONT_DIR . 'Helvetica-BoldOblique'7 ),8 'times' => array (9 'normal' => DOMPDF_FONT_DIR . 'Times-Roman',10 'bold' => DOMPDF_FONT_DIR . 'Times-Bold',11 'italic' => DOMPDF_FONT_DIR . 'Times-Italic',12 'bold_italic' => DOMPDF_FONT_DIR . 'Times-BoldItalic'13 ),14 'times-roman' => array (15 'normal' => DOMPDF_FONT_DIR . 'Times-Roman',16 'bold' => DOMPDF_FONT_DIR . 'Times-Bold',17 'italic' => DOMPDF_FONT_DIR . 'Times-Italic',18 'bold_italic' => DOMPDF_FONT_DIR . 'Times-BoldItalic'19 ),20 'courier' => array (21 'normal' => DOMPDF_FONT_DIR . 'Courier',22 'bold' => DOMPDF_FONT_DIR . 'Courier-Bold',23 'italic' => DOMPDF_FONT_DIR . 'Courier-Oblique',24 'bold_italic' => DOMPDF_FONT_DIR . 'Courier-BoldOblique'25 ),26 'helvetica' => array (27 'normal' => DOMPDF_FONT_DIR . 'Helvetica',28 'bold' => DOMPDF_FONT_DIR . 'Helvetica-Bold',29 'italic' => DOMPDF_FONT_DIR . 'Helvetica-Oblique',30 'bold_italic' => DOMPDF_FONT_DIR . 'Helvetica-BoldOblique'31 ),32 'zapfdingbats' => array (33 'normal' => DOMPDF_FONT_DIR . 'ZapfDingbats',34 'bold' => DOMPDF_FONT_DIR . 'ZapfDingbats',35 'italic' => DOMPDF_FONT_DIR . 'ZapfDingbats',36 'bold_italic' => DOMPDF_FONT_DIR . 'ZapfDingbats'37 ),38 'symbol' => array (39 'normal' => DOMPDF_FONT_DIR . 'Symbol',40 'bold' => DOMPDF_FONT_DIR . 'Symbol',41 'italic' => DOMPDF_FONT_DIR . 'Symbol',42 'bold_italic' => DOMPDF_FONT_DIR . 'Symbol'43 ),44 'serif' => array (45 'normal' => DOMPDF_FONT_DIR . 'Times-Roman',46 'bold' => DOMPDF_FONT_DIR . 'Times-Bold',47 'italic' => DOMPDF_FONT_DIR . 'Times-Italic',48 'bold_italic' => DOMPDF_FONT_DIR . 'Times-BoldItalic'49 ),50 'monospace' => array (51 'normal' => DOMPDF_FONT_DIR . 'Courier',52 'bold' => DOMPDF_FONT_DIR . 'Courier-Bold',53 'italic' => DOMPDF_FONT_DIR . 'Courier-Oblique',54 'bold_italic' => DOMPDF_FONT_DIR . 'Courier-BoldOblique'55 ),56 'fixed' => array (57 'normal' => DOMPDF_FONT_DIR . 'Courier',58 'bold' => DOMPDF_FONT_DIR . 'Courier-Bold',59 'italic' => DOMPDF_FONT_DIR . 'Courier-Oblique',60 'bold_italic' => DOMPDF_FONT_DIR . 'Courier-BoldOblique'61 )62)63/* The proper way for web browser environment independent font handling in html/css is,64 * to defining a font search path ending in serif, sans-serif, or monospace, e.g.:65 * <style>body {font-family: Verdana,Arial,Helvetica,sans-serif;}</style>66 *67 * For more satisfying results on html files without proper font search path,68 * popular fonts which are candidates for further font aliases similar to69 * 'sans-serif' and 'helvetica' above might be:70 *71 * See72 * http://www.codestyle.org/css/font-family/index.shtml73 * http://mondaybynoon.com/2007/04/02/linux-font-equivalents-to-popular-web-typefaces/74 * C:\Windows\Fonts75 *76 * Times:77 * serif, times, times-roman, times, times new roman, georgia, garamond, ms reference serif,78 * palatino, palatino linotype, dejavu serif, freeserif, liberation serif, luxi serif, 79 * century schoolbook, new century schoolbook80 *81 * Helvetica:82 * sans-serif, helvetica, helvetica, microsoft sans serif, verdana, arial, tahoma, 83 * trebuchet ms, lucida sans, ms reference sans serif, lucida grande, freesans, 84 * liberation sans, dejavu sans, luxi sans, lucida85 *86 * Courier:87 * monospace, fixed, courier, courier new, lucida console, lucida sans typewriter, freeMono, 88 * fixed, terminal, dejavu sans mono, liberation mono, luxi mono89 */90?>...

Full Screen

Full Screen

Times

Using AI Code Generation

copy

Full Screen

1use Phake;2use Phake;3use Phake;4use Phake;5use Phake;6use Phake;7use Phake;8use Phake;9use Phake;10use Phake;11use Phake;12use Phake;13use Phake;14use Phake;15use Phake;16use Phake;17use Phake;18use Phake;19use Phake;20use Phake;21use Phake;22use Phake;23use Phake;24use Phake;25use Phake;26use Phake;27use Phake;28use Phake;29use Phake;

Full Screen

Full Screen

Times

Using AI Code Generation

copy

Full Screen

1Phake::import('Times');2Phake::import('Days');3Phake::import('Months');4Phake::import('Years');5Phake::import('Times');6Phake::import('Days');7Phake::import('Months');8Phake::import('Years');9Phake::import('Times');10Phake::import('Days');11Phake::import('Months');12Phake::import('Years');13Phake::import('Times');14Phake::import('Days');15Phake::import('Months');16Phake::import('Years');17Phake::import('Times');18Phake::import('Days');19Phake::import('Months');20Phake::import('Years');21Phake::import('Times');22Phake::import('Days');23Phake::import('Months');24Phake::import('Years');25Phake::import('Times');26Phake::import('Days');27Phake::import('Months');

Full Screen

Full Screen

Times

Using AI Code Generation

copy

Full Screen

1$phake = new Phake();2$time = $phake->times();3echo $time->get('America/Chicago');4$phake = new Phake();5$time = $phake->times();6echo $time->get('America/New_York');7$phake = new Phake();8$time = $phake->times();9echo $time->get('America/Los_Angeles');10$phake = new Phake();11$time = $phake->times();12echo $time->get('Asia/Calcutta');13$phake = new Phake();14$time = $phake->times();15echo $time->get('Asia/Kolkata');16$phake = new Phake();17$time = $phake->times();18echo $time->get('Asia/Katmandu');19$phake = new Phake();20$time = $phake->times();21echo $time->get('Asia/Kathmandu');22$phake = new Phake();23$time = $phake->times();24echo $time->get('Asia/Dhaka');25$phake = new Phake();26$time = $phake->times();27echo $time->get('Asia/Colombo');28$phake = new Phake();29$time = $phake->times();30echo $time->get('Asia/Kolkata');31$phake = new Phake();32$time = $phake->times();33echo $time->get('Asia/Katmandu');34$phake = new Phake();

Full Screen

Full Screen

Times

Using AI Code Generation

copy

Full Screen

1use Phake\Mock\Method;2use Phake;3use Mock;4use Mockery;5use PHPUnit_Framework_TestCase;6use PHPUnit_Framework_MockObject_MockObject;7use PHPUnit_Framework_MockObject_MockBuilder;8use PHPUnit_Framework_MockObject_MockClass;9use PHPUnit_Framework_MockObject_MockObject;10use PHPUnit_Framework_MockObject_MockStaticMethod;11use PHPUnit_Framework_MockObject_MockTrait;12use PHPUnit_Framework_MockObject_MockType;13use PHPUnit_Framework_MockObject_Stub;14use PHPUnit_Framework_MockObject_Stub_Exception;15use PHPUnit_Framework_MockObject_Stub_Return;16use PHPUnit_Framework_MockObject_Stub_ReturnArgument;17use PHPUnit_Framework_MockObject_Stub_ReturnCallback;18use PHPUnit_Framework_MockObject_Stub_ReturnSelf;19use PHPUnit_Framework_MockObject_Stub_ReturnValueMap;20use PHPUnit_Framework_MockObject_Stub_StaticMethods;21use PHPUnit_Framework_MockObject_Stub_Verifiable;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in Times

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful